Skip to content

Commit 1b79a05

Browse files
authored
Refactor and regression tests (#34)
* chore: Add regression tests for solved puzzles * chore(puzzles/input): Update al inputs with files from site * chore: update error message * fix: Add fixes to handle bare input from source files * refactor(puzzles): Add day and year constants * refactor: Use day and year constants; trim not necessary fields * chore(scripts): Remove redundant tag * chore(puzzles/solutions): add tests for changes * ci(lint): Exclude revive inter for constants * chore: add tests for generated code * chore: Add sonar linters report * chore: Update linter configs * chore: Fix linter config * chore; Udpate ci config * docs: Add line comments * refactor: Fix linter warnings * ci: Add tests-report generation for sonar * refactor: Fix linter warnings * refactor: Fix linter warnings * ci: Fix config * refactor: Fix linter warnings * refactor: Fix linters warnings * refactor: DRY * chore: Add tests * refactor: Fix linter warnings
1 parent c0b0f70 commit 1b79a05

Some content is hidden

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

50 files changed

+3112
-854
lines changed

.github/workflows/go.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
os: [ 'ubuntu-20.04' ]
6666
go: [ '1.17' ]
6767
runs-on: ${{ matrix.os }}
68-
name: Send cover and quality reports
68+
name: Quality reports
6969
steps:
7070
- name: Checkout
7171
uses: actions/[email protected]
@@ -87,13 +87,21 @@ jobs:
8787
- name: Prepare test coverage
8888
run: |
8989
make test-cover
90+
91+
- name: Tests report
92+
run: |
93+
make test-sonar-report
94+
95+
- name: Prepare lint report
96+
run: |
97+
make lint-sonar
9098
91-
- name: Cover report
99+
- name: Cover report upload
92100
if: success()
93101
run: |
94102
bash <(curl -s https://codecov.io/bash) -f ./coverage/full.cov
95103
96-
- name: SonarCloud Scan report
104+
- name: SonarCloud report upload
97105
uses: sonarsource/[email protected]
98106
env:
99107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
bin/
1818
dist/
1919
.DS_Store
20-
coverage/
20+
coverage/
21+
tests-report.json

.golangci.pipe.yml

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ linters-settings:
1313
gofmt:
1414
simplify: true
1515
goimports:
16-
local-prefixes: github.com/obalunenko/advent-of-code
16+
local-prefixes: github.com/obalunenko/advent-of-code/
1717
revive:
1818
# see https://github.com/mgechev/revive#available-rules for details.
1919
ignore-generated-header: true
@@ -27,16 +27,6 @@ linters-settings:
2727
severity: warning
2828
arguments: [ [ "call-chain", "loop", "method-call", "recover", "return" ] ]
2929

30-
run:
31-
issues-exit-code: 1
32-
tests: true
33-
skip-dirs:
34-
- vendor/
35-
skip-files:
36-
- \.pb\.go$
37-
out-format:
38-
- github-actions
39-
4030
issues:
4131
exclude-use-default: false
4232
exclude:
@@ -64,3 +54,73 @@ issues:
6454
- gofumpt
6555
- goimports
6656
- gosimple
57+
- path: internal/puzzles/constants.go
58+
linters:
59+
- revive
60+
61+
# Show only new issues: if there are unstaged changes or untracked files,
62+
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
63+
# It's a super-useful option for integration of golangci-lint into existing
64+
# large codebase. It's not practical to fix all existing issues at the moment
65+
# of integration: much better don't allow issues in new code.
66+
# Default is false.
67+
new: true
68+
69+
# Fix found issues (if it's supported by the linter)
70+
fix: false
71+
72+
severity:
73+
# Default value is empty string.
74+
# Set the default severity for issues. If severity rules are defined and the issues
75+
# do not match or no severity is provided to the rule this will be the default
76+
# severity applied. Severities should match the supported severity names of the
77+
# selected out format.
78+
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
79+
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
80+
# - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
81+
default-severity: error
82+
83+
# The default value is false.
84+
# If set to true severity-rules regular expressions become case sensitive.
85+
case-sensitive: false
86+
87+
# Default value is empty list.
88+
# When a list of severity rules are provided, severity information will be added to lint
89+
# issues. Severity rules have the same filtering capability as exclude rules except you
90+
# are allowed to specify one matcher per severity rule.
91+
# Only affects out formats that support setting severity information.
92+
rules:
93+
- linters:
94+
- dupl
95+
severity: warning
96+
97+
run:
98+
issues-exit-code: 1
99+
tests: true
100+
skip-dirs:
101+
- vendor/
102+
skip-files:
103+
- \.pb\.go$
104+
105+
# output configuration options
106+
output:
107+
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
108+
# default is "colored-line-number"
109+
format: github-actions
110+
111+
# print lines of code with issue, default is true
112+
print-issued-lines: true
113+
114+
# print linter name in the end of issue text, default is true
115+
print-linter-name: true
116+
117+
# make issues output unique by line, default is true
118+
uniq-by-line: true
119+
120+
# add a prefix to the output file references; default is no prefix
121+
path-prefix: ""
122+
123+
# sorts results by: filepath, line and column
124+
sort-results: true
125+
126+

0 commit comments

Comments
 (0)