Skip to content

Commit

Permalink
Refactor and regression tests (#34)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
obalunenko authored Nov 6, 2021
1 parent c0b0f70 commit 1b79a05
Show file tree
Hide file tree
Showing 50 changed files with 3,112 additions and 854 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
os: [ 'ubuntu-20.04' ]
go: [ '1.17' ]
runs-on: ${{ matrix.os }}
name: Send cover and quality reports
name: Quality reports
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
Expand All @@ -87,13 +87,21 @@ jobs:
- name: Prepare test coverage
run: |
make test-cover
- name: Tests report
run: |
make test-sonar-report
- name: Prepare lint report
run: |
make lint-sonar
- name: Cover report
- name: Cover report upload
if: success()
run: |
bash <(curl -s https://codecov.io/bash) -f ./coverage/full.cov
- name: SonarCloud Scan report
- name: SonarCloud report upload
uses: sonarsource/sonarcloud-github-action@v1.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
bin/
dist/
.DS_Store
coverage/
coverage/
tests-report.json
82 changes: 71 additions & 11 deletions .golangci.pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/obalunenko/advent-of-code
local-prefixes: github.com/obalunenko/advent-of-code/
revive:
# see https://github.com/mgechev/revive#available-rules for details.
ignore-generated-header: true
Expand All @@ -27,16 +27,6 @@ linters-settings:
severity: warning
arguments: [ [ "call-chain", "loop", "method-call", "recover", "return" ] ]

run:
issues-exit-code: 1
tests: true
skip-dirs:
- vendor/
skip-files:
- \.pb\.go$
out-format:
- github-actions

issues:
exclude-use-default: false
exclude:
Expand Down Expand Up @@ -64,3 +54,73 @@ issues:
- gofumpt
- goimports
- gosimple
- path: internal/puzzles/constants.go
linters:
- revive

# Show only new issues: if there are unstaged changes or untracked files,
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
# It's a super-useful option for integration of golangci-lint into existing
# large codebase. It's not practical to fix all existing issues at the moment
# of integration: much better don't allow issues in new code.
# Default is false.
new: true

# Fix found issues (if it's supported by the linter)
fix: false

severity:
# Default value is empty string.
# Set the default severity for issues. If severity rules are defined and the issues
# do not match or no severity is provided to the rule this will be the default
# severity applied. Severities should match the supported severity names of the
# selected out format.
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
# - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
default-severity: error

# The default value is false.
# If set to true severity-rules regular expressions become case sensitive.
case-sensitive: false

# Default value is empty list.
# When a list of severity rules are provided, severity information will be added to lint
# issues. Severity rules have the same filtering capability as exclude rules except you
# are allowed to specify one matcher per severity rule.
# Only affects out formats that support setting severity information.
rules:
- linters:
- dupl
severity: warning

run:
issues-exit-code: 1
tests: true
skip-dirs:
- vendor/
skip-files:
- \.pb\.go$

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
format: github-actions

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

# make issues output unique by line, default is true
uniq-by-line: true

# add a prefix to the output file references; default is no prefix
path-prefix: ""

# sorts results by: filepath, line and column
sort-results: true


Loading

0 comments on commit 1b79a05

Please sign in to comment.