Skip to content

Commit 06b823f

Browse files
authored
feat: NEM12 headers and exporting (#85)
### 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.
1 parent b0f5710 commit 06b823f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1359
-761
lines changed

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: Test + lint
3+
on:
4+
pull_request:
5+
push:
6+
tags-ignore:
7+
- '*'
8+
paths-ignore:
9+
- '*.md'
10+
workflow_dispatch:
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: '3.2'
24+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
25+
- name: Run lints
26+
run: bundle exec rubocop
27+
28+
test:
29+
runs-on: ubuntu-latest
30+
continue-on-error: ${{ matrix.experimental }}
31+
strategy:
32+
matrix:
33+
ruby-version: ['3.1', '3.2']
34+
experimental: [false]
35+
include:
36+
- ruby-version: 'head'
37+
experimental: true
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Set up Ruby
41+
uses: ruby/setup-ruby@v1
42+
with:
43+
ruby-version: ${{ matrix.ruby-version }}
44+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
45+
- name: Run tests
46+
env:
47+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
48+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
49+
run: bundle exec rspec

.rubocop.yml

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,52 @@
1+
---
12
inherit_from: .rubocop_todo.yml
23

4+
require:
5+
- rubocop-minitest
6+
- rubocop-rspec
7+
38
AllCops:
9+
NewCops: enable
410
Exclude:
511
- 'vendor/**/*'
612
DefaultFormatter: progress
713
DisplayCopNames: true
814
DisplayStyleGuide: true
9-
ExtraDetails: true
10-
TargetRubyVersion: 2.6
11-
12-
Style/StringLiterals:
13-
EnforcedStyle: single_quotes
14-
SupportedStyles:
15-
- single_quotes
16-
- double_quotes
15+
ExtraDetails: 3.2
1716

18-
# Metrics/AbcSize:
19-
# # Target: 15
20-
# Max: 175
21-
Metrics/LineLength:
17+
# Overrides.
18+
Layout/LineLength:
2219
AllowHeredoc: true
2320
AllowURI: true
21+
Exclude:
22+
- 'spec/**/*_spec.rb'
2423
URISchemes:
2524
- http
2625
- https
27-
# Target: 80
28-
# Max: 210
29-
# Metrics/MethodLength:
30-
# # Target 10
31-
# Max: 80
32-
# Metrics/ClassLength:
33-
# Max: 600
34-
# Metrics/CyclomaticComplexity:
35-
# # Target 6
36-
# Max: 29
37-
# Metrics/PerceivedComplexity:
38-
# # Target 7
39-
# Max: 29
26+
Max: 210
27+
Metrics/AbcSize:
28+
# Target: 15
29+
Max: 190
4030
Metrics/BlockLength:
4131
Exclude:
4232
- 'spec/**/*'
4333
- 'aemo.gemspec'
34+
# Target: 25
35+
Max: 40
36+
Metrics/ClassLength:
37+
Max: 600
38+
Metrics/CyclomaticComplexity:
39+
# Target 6
40+
Max: 40
41+
Metrics/MethodLength:
42+
# Target 10
43+
Max: 80
44+
Metrics/PerceivedComplexity:
45+
# Target 7
46+
Max: 38
47+
Style/StringLiterals:
48+
EnforcedStyle: single_quotes
49+
SupportedStyles:
50+
- single_quotes
51+
- double_quotes
52+

.rubocop_todo.yml

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

9-
# Offense count: 18
10-
Metrics/AbcSize:
11-
Max: 165
10+
# Offense count: 8
11+
# Configuration parameters: Prefixes, AllowedPatterns.
12+
# Prefixes: when, with, without
13+
RSpec/ContextWording:
14+
Exclude:
15+
- 'spec/lib/aemo/nem12_spec.rb'
16+
- 'spec/lib/aemo/nmi/allocation_spec.rb'
17+
- 'spec/lib/aemo/nmi_spec.rb'
1218

13-
# Offense count: 1
14-
# Configuration parameters: CountComments, ExcludedMethods.
15-
Metrics/BlockLength:
16-
Max: 35
19+
# Offense count: 6
20+
# Configuration parameters: CountAsOne.
21+
RSpec/ExampleLength:
22+
Max: 23
1723

18-
# Offense count: 3
19-
# Configuration parameters: CountComments.
20-
Metrics/ClassLength:
21-
Max: 499
24+
# Offense count: 44
25+
# Configuration parameters: AssignmentOnly.
26+
RSpec/InstanceVariable:
27+
Exclude:
28+
- 'spec/lib/aemo/market/interval_spec.rb'
29+
- 'spec/lib/aemo/market/node_spec.rb'
30+
- 'spec/lib/aemo/nmi_spec.rb'
31+
- 'spec/lib/aemo/region_spec.rb'
2232

23-
# Offense count: 8
24-
Metrics/CyclomaticComplexity:
25-
Max: 29
33+
# Offense count: 6
34+
RSpec/MultipleExpectations:
35+
Max: 5
2636

27-
# Offense count: 191
28-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
29-
# URISchemes: http, https
30-
Metrics/LineLength:
31-
Max: 192
37+
# Offense count: 10
38+
# Configuration parameters: AllowedGroups.
39+
RSpec/NestedGroups:
40+
Max: 4
3241

33-
# Offense count: 14
34-
# Configuration parameters: CountComments.
35-
Metrics/MethodLength:
36-
Max: 51
42+
# Offense count: 2
43+
# Configuration parameters: AllowedPatterns.
44+
# AllowedPatterns: ^expect_, ^assert_
45+
RSpec/NoExpectationExample:
46+
Exclude:
47+
- 'spec/lib/aemo/msats_spec.rb'
3748

38-
# Offense count: 7
39-
Metrics/PerceivedComplexity:
40-
Max: 29
49+
# Offense count: 17
50+
RSpec/RepeatedDescription:
51+
Exclude:
52+
- 'spec/lib/aemo/market/interval_spec.rb'
53+
- 'spec/lib/aemo/msats_spec.rb'
54+
- 'spec/lib/aemo/nem12_spec.rb'
55+
- 'spec/lib/aemo/nmi_spec.rb'

.travis.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# AEMO Gem Changelog
22

3+
## [v0.6.0] (2023-12-20)
4+
5+
### Added
6+
7+
* Ability to output a valid NEM12 file from a single, or an array of, `AEMO::NEM12` with `to_nem12_csv`.
8+
* `AEMO::Time` for customised formatting, parsing, and validating in `NEMTIME`.
9+
* Github actions for tests and lints.
10+
11+
### Changed
12+
13+
* Correctly set `AEMO::NEM12` header value set at parsing.
14+
315
## [v0.5.1] (2023-06-16)
416

517
### Changed

Gemfile

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,26 @@
22

33
source 'https://rubygems.org'
44

5-
source 'https://rubygems.org' do
6-
# Specify your gem's dependencies in aemo.gemspec
7-
gemspec
5+
# Specify your gem's production dependencies in [aemo.gemspec](./aemo.gemspec).
6+
gemspec
7+
8+
# Specify the development/test gems here.
9+
group :development, :test do
10+
gem 'addressable', '~> 2.8', '>= 2.8.0'
11+
gem 'awesome_print', '~> 1.8', '>= 1.8.0'
12+
gem 'coveralls_reborn', '~> 0.28', '>= 0.28.0'
13+
gem 'ffi', '~> 1.16', '> 1.9.18'
14+
gem 'guard-yard', '~> 2.2', '>= 2.2.0'
15+
gem 'listen', '~> 3.1', '>= 3.5.0'
16+
gem 'minitest', '~> 5.14', '>= 5.14.2'
17+
gem 'rack', '~> 3.0', '>= 3.0.8'
18+
gem 'rdoc', '~> 6.3', '>= 5.1.0'
19+
gem 'rspec', '~> 3.7', '>= 3.7.0'
20+
gem 'rubocop', '~> 1.59', '>= 0.52.1'
21+
gem 'rubocop-minitest'
22+
gem 'rubocop-rspec'
23+
gem 'simplecov', '~> 0.14', '>= 0.14.1'
24+
gem 'timecop', '~> 0.9', '>= 0.9.1'
25+
gem 'webmock', '~> 3.1', '>= 3.1.0'
26+
gem 'yard', '~> 0.9', '>= 0.9.11'
827
end

0 commit comments

Comments
 (0)