Skip to content

Commit

Permalink
feat: NEM12 headers and exporting (#85)
Browse files Browse the repository at this point in the history
### Added

*   Ability to output a valid NEM12 file from a single, or an array of, `AEMO::NEM12` with `to_nem12_csv`.
*   `AEMO::Time` for customised formatting, parsing, and validating in `NEMTIME`.
*   Github actions for tests and lints.

### Changed

*   Correctly set `AEMO::NEM12` header value set at parsing.
  • Loading branch information
jufemaiz committed Dec 20, 2023
1 parent b0f5710 commit 06b823f
Show file tree
Hide file tree
Showing 41 changed files with 1,359 additions and 761 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Test + lint
on:
pull_request:
push:
tags-ignore:
- '*'
paths-ignore:
- '*.md'
workflow_dispatch:
permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run lints
run: bundle exec rubocop

test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
ruby-version: ['3.1', '3.2']
experimental: [false]
include:
- ruby-version: 'head'
experimental: true
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: bundle exec rspec
59 changes: 34 additions & 25 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
---
inherit_from: .rubocop_todo.yml

require:
- rubocop-minitest
- rubocop-rspec

AllCops:
NewCops: enable
Exclude:
- 'vendor/**/*'
DefaultFormatter: progress
DisplayCopNames: true
DisplayStyleGuide: true
ExtraDetails: true
TargetRubyVersion: 2.6

Style/StringLiterals:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
ExtraDetails: 3.2

# Metrics/AbcSize:
# # Target: 15
# Max: 175
Metrics/LineLength:
# Overrides.
Layout/LineLength:
AllowHeredoc: true
AllowURI: true
Exclude:
- 'spec/**/*_spec.rb'
URISchemes:
- http
- https
# Target: 80
# Max: 210
# Metrics/MethodLength:
# # Target 10
# Max: 80
# Metrics/ClassLength:
# Max: 600
# Metrics/CyclomaticComplexity:
# # Target 6
# Max: 29
# Metrics/PerceivedComplexity:
# # Target 7
# Max: 29
Max: 210
Metrics/AbcSize:
# Target: 15
Max: 190
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- 'aemo.gemspec'
# Target: 25
Max: 40
Metrics/ClassLength:
Max: 600
Metrics/CyclomaticComplexity:
# Target 6
Max: 40
Metrics/MethodLength:
# Target 10
Max: 80
Metrics/PerceivedComplexity:
# Target 7
Max: 38
Style/StringLiterals:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes

69 changes: 42 additions & 27 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,55 @@
---
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-05-01 11:12:22 +1000 using RuboCop version 0.50.0.
# on 2023-12-19 05:58:24 UTC using RuboCop version 1.59.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 18
Metrics/AbcSize:
Max: 165
# Offense count: 8
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/lib/aemo/nem12_spec.rb'
- 'spec/lib/aemo/nmi/allocation_spec.rb'
- 'spec/lib/aemo/nmi_spec.rb'

# Offense count: 1
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 35
# Offense count: 6
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 23

# Offense count: 3
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 499
# Offense count: 44
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/lib/aemo/market/interval_spec.rb'
- 'spec/lib/aemo/market/node_spec.rb'
- 'spec/lib/aemo/nmi_spec.rb'
- 'spec/lib/aemo/region_spec.rb'

# Offense count: 8
Metrics/CyclomaticComplexity:
Max: 29
# Offense count: 6
RSpec/MultipleExpectations:
Max: 5

# Offense count: 191
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 192
# Offense count: 10
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 4

# Offense count: 14
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 51
# Offense count: 2
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Exclude:
- 'spec/lib/aemo/msats_spec.rb'

# Offense count: 7
Metrics/PerceivedComplexity:
Max: 29
# Offense count: 17
RSpec/RepeatedDescription:
Exclude:
- 'spec/lib/aemo/market/interval_spec.rb'
- 'spec/lib/aemo/msats_spec.rb'
- 'spec/lib/aemo/nem12_spec.rb'
- 'spec/lib/aemo/nmi_spec.rb'
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# AEMO Gem Changelog

## [v0.6.0] (2023-12-20)

### Added

* Ability to output a valid NEM12 file from a single, or an array of, `AEMO::NEM12` with `to_nem12_csv`.
* `AEMO::Time` for customised formatting, parsing, and validating in `NEMTIME`.
* Github actions for tests and lints.

### Changed

* Correctly set `AEMO::NEM12` header value set at parsing.

## [v0.5.1] (2023-06-16)

### Changed
Expand Down
25 changes: 22 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@

source 'https://rubygems.org'

source 'https://rubygems.org' do
# Specify your gem's dependencies in aemo.gemspec
gemspec
# Specify your gem's production dependencies in [aemo.gemspec](./aemo.gemspec).
gemspec

# Specify the development/test gems here.
group :development, :test do
gem 'addressable', '~> 2.8', '>= 2.8.0'
gem 'awesome_print', '~> 1.8', '>= 1.8.0'
gem 'coveralls_reborn', '~> 0.28', '>= 0.28.0'
gem 'ffi', '~> 1.16', '> 1.9.18'
gem 'guard-yard', '~> 2.2', '>= 2.2.0'
gem 'listen', '~> 3.1', '>= 3.5.0'
gem 'minitest', '~> 5.14', '>= 5.14.2'
gem 'rack', '~> 3.0', '>= 3.0.8'
gem 'rdoc', '~> 6.3', '>= 5.1.0'
gem 'rspec', '~> 3.7', '>= 3.7.0'
gem 'rubocop', '~> 1.59', '>= 0.52.1'
gem 'rubocop-minitest'
gem 'rubocop-rspec'
gem 'simplecov', '~> 0.14', '>= 0.14.1'
gem 'timecop', '~> 0.9', '>= 0.9.1'
gem 'webmock', '~> 3.1', '>= 3.1.0'
gem 'yard', '~> 0.9', '>= 0.9.11'
end
Loading

0 comments on commit 06b823f

Please sign in to comment.