├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report_without_reproduction.md │ ├── config.yml │ └── documentation.md ├── PULL_REQUEST_TEMPLATE.md ├── config │ └── rubocop_linter_action.yml └── workflows │ ├── changelog.yml │ ├── dispatch.yml │ ├── label_merge_conflicts.yml │ ├── linters.yml │ ├── pull_request.yml │ └── test.yml ├── .gitignore ├── .ruby-version ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── action.yml ├── bin ├── format ├── rspec ├── standardrb └── test ├── codecov.yml ├── entrypoint.sh ├── lib ├── command.rb ├── configuration.rb ├── github │ ├── check_run_service.rb │ ├── client.rb │ └── data.rb ├── index.rb ├── install.rb ├── report.rb ├── report_adapter.rb ├── results.rb └── util.rb ├── screenshots ├── check-overview.png ├── file-annotation.png └── rubocop-linter-action.png └── spec ├── command_spec.rb ├── fixtures ├── config.yml ├── example.json ├── example.yml └── report.json ├── github_check_run_service_spec.rb ├── github_data_spec.rb ├── helpers.rb ├── install_spec.rb ├── report_adapter_spec.rb ├── spec_helper.rb └── util_spec.rb /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: andrewmcodes 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report_without_reproduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | title: "" 4 | labels: bug, no-reproduction 5 | assignees: "" 6 | --- 7 | 8 | # Bug Report 9 | 10 | 13 | 14 | ## Describe the bug 15 | 16 | 17 | 18 | # Reproduction Steps 19 | 20 | 21 | 22 | # Expected behavior 23 | 24 | 25 | 26 | ## Stacktrace 27 | 28 | 29 | 30 | ## Action Version & Workflow File 31 | 32 | - Version [e.g. v0.0.1] 33 | 34 | ### Workflow File 35 | 36 | ```yaml 37 | # my workflow 38 | ``` 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation issue 3 | about: Select this option if you have found an issue with the docs, or think something should be added. 4 | title: "" 5 | labels: documentation 6 | assignees: "" 7 | --- 8 | 9 | # Documentation 10 | 11 | ## Describe 12 | 13 | 14 | 15 | ## Why should this be added 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Type of PR 2 | 3 | - [ ] feature 4 | - [ ] enhancement 5 | - [ ] bug fix 6 | - [ ] other 7 | 8 | ## Description 9 | 10 | 11 | 12 | 13 | 14 | ## Checklist 15 | 16 | - [ ] My code follows the style guidelines of this project 17 | - [ ] Actions are passing 18 | - [ ] I have updated the documentation if applicable 19 | 20 | ## Tests 21 | 22 | - [ ] I have added tests 23 | - [ ] I have a sample app to demonstrate this is working and the link is: 24 | - [ ] I did not test it but I have a good reason.. (please let me know below :smile:) 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/config/rubocop_linter_action.yml: -------------------------------------------------------------------------------- 1 | # Description: The name of the check that will be created. 2 | # Valid Options: A reasonably sized string. 3 | # Default: 'RuboCop Action' 4 | check_name: "RuboCop Results" 5 | 6 | # Description: Versions required to run your RuboCop checks. 7 | # Valid options: RuboCop and any RuboCop extension, by default the latest gem version will be used. You can explicitly state that 8 | # (not required) or use a version number, like '1.5.1'. 9 | # Default: 10 | # versions: 11 | # - rubocop: 'latest' 12 | versions: 13 | - rubocop 14 | - rubocop-rails 15 | - rubocop-minitest 16 | - rubocop-performance: "1.5.1" 17 | - rubocop-rspec: "1.37.0" 18 | 19 | # Description: RuboCop configuration file path relative to the workspace. 20 | # Valid options: A valid file path inside of the workspace. 21 | # Default: nil 22 | # Note: This does not need to be filled out for RuboCop to still find your config. 23 | # Resource: https://rubocop.readthedocs.io/en/stable/configuration/ 24 | rubocop_config_path: ".rubocop.yml" 25 | 26 | # Run all cops enabled by configuration except this list. 27 | # Valid options: list of valid cop(s) and/or departments. 28 | # Default: nil 29 | # Resource: https://rubocop.readthedocs.io/en/stable/cops/ 30 | rubocop_excluded_cops: 31 | - "Style/FrozenStringLiteralComment" 32 | 33 | # Minimum severity for exit with error code 34 | # Valid options: 'refactor', 'convention', 'warning', 'error', or 'fatal'. 35 | # Default: 'warning' 36 | # Resource: https://rubocop.readthedocs.io/en/stable/configuration/#severity 37 | rubocop_fail_level: "warning" 38 | 39 | # Whether or not to use --force-exclusion when building the rubocop command. Use this if you are only linting modified 40 | # files and typically excluded files have been changed. For example, if you exclude db/schema.rb in your rubocop.yml 41 | # but a change gets made, then with the check_scope config set to 'modified' rubocop will lint db/schema.rb. If you set 42 | # this to true, rubocop will ignore it. 43 | # Valid options: true || false 44 | # Default: false 45 | rubocop_force_exclusion: true 46 | 47 | # Instead of installing gems from rubygems, we can run `bundle install` on your project, 48 | # you would need to do this if you are using something like 'rubocop-github' or if you don't 49 | # want to list out dependencies with the `versions` key. 50 | # Valid options: true || false 51 | # Default: false 52 | bundle: false 53 | 54 | # The scope of code that RuboCop should lint. Use this if you only want to lint changed files. If this is not set 55 | # or not equal to 'modified', RuboCop is run against the entire codebase. Note that this will not work on the master branch. 56 | # Valid options: 'modified' 57 | # Default: nil 58 | check_scope: "modified" 59 | 60 | # The base branch against which changes will be compared, if check_scope config is set to 'modified'. 61 | # This setting is not used if check_scope != 'modified'. 62 | # Valid options: 'origin/another_branch' 63 | # Default: 'origin/master' 64 | base_branch: "origin/master" 65 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: Changelog 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | timeout-minutes: 4 11 | if: "!contains(github.event.head_commit.message, '[no changelog entry]')" 12 | steps: 13 | - uses: actions/checkout@master 14 | - name: Set up Ruby 2.7 15 | uses: actions/setup-ruby@v1 16 | with: 17 | ruby-version: 2.7.x 18 | - uses: actions/cache@v1.1.2 19 | with: 20 | path: vendor/bundle 21 | key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} 22 | restore-keys: | 23 | ${{ runner.os }}-gem- 24 | - name: Create local changes 25 | run: | 26 | gem install bundler 27 | bundle config path vendor/bundle 28 | bundle install --jobs 4 --retry 3 29 | bundle exec github_changelog_generator -u andrewmcodes -p rubocop-linter-action --token ${{ secrets.GITHUB_TOKEN }} 30 | - name: Commit files 31 | run: | 32 | git config --local user.email "andrewmcodes@protonmail.com" 33 | git config --local user.name "Andrew Mason" 34 | git commit -m "Update changelog" -a 35 | - name: Push changes 36 | uses: ad-m/github-push-action@master 37 | with: 38 | github_token: ${{ secrets.GITHUB_TOKEN }} 39 | -------------------------------------------------------------------------------- /.github/workflows/dispatch.yml: -------------------------------------------------------------------------------- 1 | name: Dispatch 2 | 3 | on: push 4 | 5 | jobs: 6 | dispatch: 7 | name: Update playground 8 | runs-on: ubuntu-latest 9 | timeout-minutes: 2 10 | if: "!contains(github.event.head_commit.message, '[ci skip]')" 11 | steps: 12 | - uses: actions/checkout@v1 13 | - name: Repository Dispatch 14 | uses: peter-evans/repository-dispatch@v1 15 | with: 16 | token: ${{ secrets.DISPATCH_ACCESS_TOKEN }} 17 | repository: handcars/rubocop-linter-action-playground 18 | event-type: rubocop-linter-action-test 19 | client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "actor": "${{ github.actor }}"}' 20 | -------------------------------------------------------------------------------- /.github/workflows/label_merge_conflicts.yml: -------------------------------------------------------------------------------- 1 | name: Check for merge conflicts 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | triage: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: mschilde/auto-label-merge-conflicts@v2.0 13 | with: 14 | CONFLICT_LABEL_NAME: 'has conflicts' 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/linters.yml: -------------------------------------------------------------------------------- 1 | name: Linters 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "*" 7 | push: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | standardrb: 13 | name: StandardRB Check Action 14 | runs-on: ubuntu-latest 15 | if: "!contains(github.event.head_commit.message, 'ci skip')" 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Set up Ruby 2.7 19 | uses: ruby/setup-ruby@v1 20 | with: 21 | ruby-version: 2.7.1 22 | - name: Cache gems 23 | uses: actions/cache@v1 24 | with: 25 | path: vendor/bundle 26 | key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} 27 | restore-keys: | 28 | ${{ runner.os }}-gems- 29 | - name: Install gems 30 | run: | 31 | bundle config path vendor/bundle 32 | bundle install --jobs 4 --retry 3 33 | - name: Run StandardRB 34 | run: bin/standardrb 35 | -------------------------------------------------------------------------------- /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | types: [opened] 4 | name: Pull Request 5 | jobs: 6 | assignAuthor: 7 | name: Assign author to PR 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Assign author to PR 11 | uses: technote-space/assign-author@v1 12 | with: 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 14 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - '*' 7 | push: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | test: 13 | name: Rspec Test Action 14 | runs-on: ubuntu-latest 15 | timeout-minutes: 2 16 | if: "!contains(github.event.head_commit.message, '[ci skip]')" 17 | steps: 18 | - uses: actions/checkout@master 19 | - name: Set up Ruby 2.7 20 | uses: actions/setup-ruby@v1 21 | with: 22 | ruby-version: 2.7.x 23 | - uses: actions/cache@v1.1.2 24 | with: 25 | path: vendor/bundle 26 | key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} 27 | restore-keys: | 28 | ${{ runner.os }}-gem- 29 | - name: Bundle 30 | run: | 31 | gem install bundler 32 | bundle config path vendor/bundle 33 | bundle install --jobs 4 --retry 3 34 | - name: Run Rspec 35 | run: bin/test 36 | env: 37 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /tmp/ 2 | /.vscode/ 3 | .python-version 4 | /coverage/ 5 | /.bundle/ 6 | /vendor/ 7 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.1 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [v3.3.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.3.0) (2020-09-12) 4 | 5 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.2.0...v3.3.0) 6 | 7 | **Implemented enhancements:** 8 | 9 | - Only run Rubocop against the diff [\#159](https://github.com/andrewmcodes/rubocop-linter-action/issues/159) 10 | - Meta updates [\#150](https://github.com/andrewmcodes/rubocop-linter-action/issues/150) 11 | - refactor: remove old docs and update the ones in the readme [\#160](https://github.com/andrewmcodes/rubocop-linter-action/pull/160) ([andrewmcodes](https://github.com/andrewmcodes)) 12 | 13 | **Fixed bugs:** 14 | 15 | - No such file or directory - rubocop \(Errno::ENOENT\) [\#138](https://github.com/andrewmcodes/rubocop-linter-action/issues/138) 16 | - check\_scope modified has a git failure but still runs [\#135](https://github.com/andrewmcodes/rubocop-linter-action/issues/135) 17 | 18 | **Closed issues:** 19 | 20 | - Put docs back in README or wiki [\#157](https://github.com/andrewmcodes/rubocop-linter-action/issues/157) 21 | - The project name casing is incorrect. [\#154](https://github.com/andrewmcodes/rubocop-linter-action/issues/154) 22 | - Allow the github action check to fail [\#149](https://github.com/andrewmcodes/rubocop-linter-action/issues/149) 23 | - Use Rubocop version from Gemfile.lock [\#147](https://github.com/andrewmcodes/rubocop-linter-action/issues/147) 24 | - Configurable Rubocop Version [\#145](https://github.com/andrewmcodes/rubocop-linter-action/issues/145) 25 | - Turn off ruby linter annotation on PR page [\#144](https://github.com/andrewmcodes/rubocop-linter-action/issues/144) 26 | 27 | **Merged pull requests:** 28 | 29 | - Tweak exit strategy [\#161](https://github.com/andrewmcodes/rubocop-linter-action/pull/161) ([andrewmcodes](https://github.com/andrewmcodes)) 30 | - Updating strategy for documentation [\#158](https://github.com/andrewmcodes/rubocop-linter-action/pull/158) ([johnfelixespinosa](https://github.com/johnfelixespinosa)) 31 | - Bump activesupport from 6.0.3 to 6.0.3.2 [\#155](https://github.com/andrewmcodes/rubocop-linter-action/pull/155) ([dependabot[bot]](https://github.com/apps/dependabot)) 32 | - Exit code if linter returns some failures [\#153](https://github.com/andrewmcodes/rubocop-linter-action/pull/153) ([MiguelSavignano](https://github.com/MiguelSavignano)) 33 | - Update faq.md [\#152](https://github.com/andrewmcodes/rubocop-linter-action/pull/152) ([kmcclellan](https://github.com/kmcclellan)) 34 | - Find modified files with respect to base commit of branch [\#139](https://github.com/andrewmcodes/rubocop-linter-action/pull/139) ([hasghari](https://github.com/hasghari)) 35 | 36 | ## [v3.2.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.2.0) (2020-05-08) 37 | 38 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.1.0...v3.2.0) 39 | 40 | **Implemented enhancements:** 41 | 42 | - update dependencies [\#143](https://github.com/andrewmcodes/rubocop-linter-action/pull/143) ([andrewmcodes](https://github.com/andrewmcodes)) 43 | 44 | **Fixed bugs:** 45 | 46 | - remove shell\_lint action [\#141](https://github.com/andrewmcodes/rubocop-linter-action/pull/141) ([andrewmcodes](https://github.com/andrewmcodes)) 47 | 48 | **Closed issues:** 49 | 50 | - cannot load such file -- rubocop-rails [\#137](https://github.com/andrewmcodes/rubocop-linter-action/issues/137) 51 | 52 | **Merged pull requests:** 53 | 54 | - Create FUNDING.yml [\#142](https://github.com/andrewmcodes/rubocop-linter-action/pull/142) ([andrewmcodes](https://github.com/andrewmcodes)) 55 | - Allow passing `configuration.base\_branch` [\#136](https://github.com/andrewmcodes/rubocop-linter-action/pull/136) ([arich](https://github.com/arich)) 56 | - Ignore stderr when running the command [\#132](https://github.com/andrewmcodes/rubocop-linter-action/pull/132) ([michaelherold](https://github.com/michaelherold)) 57 | 58 | ## [v3.1.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.1.0) (2020-03-12) 59 | 60 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.0.0...v3.1.0) 61 | 62 | **Implemented enhancements:** 63 | 64 | - Add Force Exclusion configuration option [\#126](https://github.com/andrewmcodes/rubocop-linter-action/issues/126) 65 | - chore: dependency updates [\#128](https://github.com/andrewmcodes/rubocop-linter-action/pull/128) ([andrewmcodes](https://github.com/andrewmcodes)) 66 | 67 | **Fixed bugs:** 68 | 69 | - Configuration file seems not to be loading [\#123](https://github.com/andrewmcodes/rubocop-linter-action/issues/123) 70 | - Unable to pull private gem [\#121](https://github.com/andrewmcodes/rubocop-linter-action/issues/121) 71 | - Only modified files [\#105](https://github.com/andrewmcodes/rubocop-linter-action/issues/105) 72 | 73 | **Closed issues:** 74 | 75 | - Unclear documentation around action secrets [\#125](https://github.com/andrewmcodes/rubocop-linter-action/issues/125) 76 | - Are we able to run ruby 2.6.5 with version 3? [\#124](https://github.com/andrewmcodes/rubocop-linter-action/issues/124) 77 | 78 | **Merged pull requests:** 79 | 80 | - Release v3.1.0 [\#130](https://github.com/andrewmcodes/rubocop-linter-action/pull/130) ([andrewmcodes](https://github.com/andrewmcodes)) 81 | - docs: add es50678 as a contributor [\#129](https://github.com/andrewmcodes/rubocop-linter-action/pull/129) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 82 | - Add Force Exclusion configuration option [\#127](https://github.com/andrewmcodes/rubocop-linter-action/pull/127) ([es50678](https://github.com/es50678)) 83 | 84 | ## [v3.0.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.0.0) (2020-01-24) 85 | 86 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.0.0.rc4...v3.0.0) 87 | 88 | **Breaking changes:** 89 | 90 | - release v3.0.0 [\#120](https://github.com/andrewmcodes/rubocop-linter-action/pull/120) ([andrewmcodes](https://github.com/andrewmcodes)) 91 | 92 | **Implemented enhancements:** 93 | 94 | - document the behavior of check\_scope on commits to master [\#119](https://github.com/andrewmcodes/rubocop-linter-action/pull/119) ([andrewmcodes](https://github.com/andrewmcodes)) 95 | - address codefactor issues [\#114](https://github.com/andrewmcodes/rubocop-linter-action/pull/114) ([andrewmcodes](https://github.com/andrewmcodes)) 96 | - add pull\_request action [\#113](https://github.com/andrewmcodes/rubocop-linter-action/pull/113) ([andrewmcodes](https://github.com/andrewmcodes)) 97 | - add codecov and binstub helpers [\#112](https://github.com/andrewmcodes/rubocop-linter-action/pull/112) ([andrewmcodes](https://github.com/andrewmcodes)) 98 | - update playground location [\#111](https://github.com/andrewmcodes/rubocop-linter-action/pull/111) ([andrewmcodes](https://github.com/andrewmcodes)) 99 | - \[ci-skip\] add ci-skip option for actions [\#110](https://github.com/andrewmcodes/rubocop-linter-action/pull/110) ([andrewmcodes](https://github.com/andrewmcodes)) 100 | - update the dates in the license [\#109](https://github.com/andrewmcodes/rubocop-linter-action/pull/109) ([andrewmcodes](https://github.com/andrewmcodes)) 101 | - update issue templates [\#108](https://github.com/andrewmcodes/rubocop-linter-action/pull/108) ([andrewmcodes](https://github.com/andrewmcodes)) 102 | - Configuration File [\#75](https://github.com/andrewmcodes/rubocop-linter-action/pull/75) ([andrewmcodes](https://github.com/andrewmcodes)) 103 | 104 | **Fixed bugs:** 105 | 106 | - Rubocop Results action is running forever [\#96](https://github.com/andrewmcodes/rubocop-linter-action/issues/96) 107 | 108 | **Closed issues:** 109 | 110 | - Lint changed files only instead [\#70](https://github.com/andrewmcodes/rubocop-linter-action/issues/70) 111 | 112 | **Merged pull requests:** 113 | 114 | - update codecov integration [\#115](https://github.com/andrewmcodes/rubocop-linter-action/pull/115) ([andrewmcodes](https://github.com/andrewmcodes)) 115 | - change example workflow to use actions/checkout@v1 [\#107](https://github.com/andrewmcodes/rubocop-linter-action/pull/107) ([andrewmcodes](https://github.com/andrewmcodes)) 116 | - docs: add seerahulsingh as a contributor [\#104](https://github.com/andrewmcodes/rubocop-linter-action/pull/104) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 117 | - Work around 50-annotation limit by making multiple update calls [\#85](https://github.com/andrewmcodes/rubocop-linter-action/pull/85) ([reidab](https://github.com/reidab)) 118 | - Ensure start\_column comes before end\_column [\#84](https://github.com/andrewmcodes/rubocop-linter-action/pull/84) ([reidab](https://github.com/reidab)) 119 | - Create initial GitHub check before running rubocop [\#83](https://github.com/andrewmcodes/rubocop-linter-action/pull/83) ([reidab](https://github.com/reidab)) 120 | - version 3.0.0.rc1 release [\#82](https://github.com/andrewmcodes/rubocop-linter-action/pull/82) ([andrewmcodes](https://github.com/andrewmcodes)) 121 | 122 | ## [v3.0.0.rc4](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.0.0.rc4) (2020-01-16) 123 | 124 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.0.0.rc3...v3.0.0.rc4) 125 | 126 | **Merged pull requests:** 127 | 128 | - version 3.0.0.rc4 release [\#103](https://github.com/andrewmcodes/rubocop-linter-action/pull/103) ([andrewmcodes](https://github.com/andrewmcodes)) 129 | - upgrade to ruby 2.7 [\#102](https://github.com/andrewmcodes/rubocop-linter-action/pull/102) ([andrewmcodes](https://github.com/andrewmcodes)) 130 | - try to prevent infinite runs [\#101](https://github.com/andrewmcodes/rubocop-linter-action/pull/101) ([andrewmcodes](https://github.com/andrewmcodes)) 131 | 132 | ## [v3.0.0.rc3](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.0.0.rc3) (2020-01-11) 133 | 134 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.0.0.rc2...v3.0.0.rc3) 135 | 136 | **Implemented enhancements:** 137 | 138 | - Specify RuboCop version and its extensions using the same configuration key [\#93](https://github.com/andrewmcodes/rubocop-linter-action/issues/93) 139 | 140 | **Fixed bugs:** 141 | 142 | - Action breaks if RuboCop check outputs a start\_column value greater than the last\_column for the line [\#91](https://github.com/andrewmcodes/rubocop-linter-action/issues/91) 143 | 144 | **Merged pull requests:** 145 | 146 | - Add documentation around what will happen if the action is triggered by a pr from a forked repo [\#100](https://github.com/andrewmcodes/rubocop-linter-action/pull/100) ([andrewmcodes](https://github.com/andrewmcodes)) 147 | - issue 96 exploration [\#99](https://github.com/andrewmcodes/rubocop-linter-action/pull/99) ([andrewmcodes](https://github.com/andrewmcodes)) 148 | - tweak the way we read the config file [\#98](https://github.com/andrewmcodes/rubocop-linter-action/pull/98) ([andrewmcodes](https://github.com/andrewmcodes)) 149 | - Enhanced dependency configuration and resolution [\#95](https://github.com/andrewmcodes/rubocop-linter-action/pull/95) ([erichmachado](https://github.com/erichmachado)) 150 | - docs: add erichmachado as a contributor [\#94](https://github.com/andrewmcodes/rubocop-linter-action/pull/94) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 151 | - ReportAdapter\#column\_check correctly parses the last\_column value [\#92](https://github.com/andrewmcodes/rubocop-linter-action/pull/92) ([erichmachado](https://github.com/erichmachado)) 152 | 153 | ## [v3.0.0.rc2](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.0.0.rc2) (2019-12-20) 154 | 155 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v3.0.0.rc1...v3.0.0.rc2) 156 | 157 | **Merged pull requests:** 158 | 159 | - v3.0.0.rc2 release [\#89](https://github.com/andrewmcodes/rubocop-linter-action/pull/89) ([andrewmcodes](https://github.com/andrewmcodes)) 160 | - refactor and update docs [\#88](https://github.com/andrewmcodes/rubocop-linter-action/pull/88) ([andrewmcodes](https://github.com/andrewmcodes)) 161 | - Update build action [\#86](https://github.com/andrewmcodes/rubocop-linter-action/pull/86) ([andrewmcodes](https://github.com/andrewmcodes)) 162 | 163 | ## [v3.0.0.rc1](https://github.com/andrewmcodes/rubocop-linter-action/tree/v3.0.0.rc1) (2019-12-19) 164 | 165 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v2.0.1...v3.0.0.rc1) 166 | 167 | **Merged pull requests:** 168 | 169 | - docs: add excid3 as a contributor [\#81](https://github.com/andrewmcodes/rubocop-linter-action/pull/81) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 170 | 171 | ## [v2.0.1](https://github.com/andrewmcodes/rubocop-linter-action/tree/v2.0.1) (2019-12-18) 172 | 173 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v2.0.0...v2.0.1) 174 | 175 | **Fixed bugs:** 176 | 177 | - The RuboCop version is not respected if there are extra gems [\#67](https://github.com/andrewmcodes/rubocop-linter-action/issues/67) 178 | - Rubocop action stops the build even when level is set to fatal [\#63](https://github.com/andrewmcodes/rubocop-linter-action/issues/63) 179 | 180 | **Closed issues:** 181 | 182 | - This action seems to not work for Pull Requests [\#68](https://github.com/andrewmcodes/rubocop-linter-action/issues/68) 183 | - \[request\] ability to set working directory [\#64](https://github.com/andrewmcodes/rubocop-linter-action/issues/64) 184 | 185 | **Merged pull requests:** 186 | 187 | - fix image address for readthedocs index [\#80](https://github.com/andrewmcodes/rubocop-linter-action/pull/80) ([andrewmcodes](https://github.com/andrewmcodes)) 188 | - add readthedocs config [\#79](https://github.com/andrewmcodes/rubocop-linter-action/pull/79) ([andrewmcodes](https://github.com/andrewmcodes)) 189 | - version 2.0.1 release [\#78](https://github.com/andrewmcodes/rubocop-linter-action/pull/78) ([andrewmcodes](https://github.com/andrewmcodes)) 190 | - add documentation for readthedocs [\#77](https://github.com/andrewmcodes/rubocop-linter-action/pull/77) ([andrewmcodes](https://github.com/andrewmcodes)) 191 | - docs: add hackerdude as a contributor [\#76](https://github.com/andrewmcodes/rubocop-linter-action/pull/76) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 192 | - only push to the playground repo on push [\#74](https://github.com/andrewmcodes/rubocop-linter-action/pull/74) ([andrewmcodes](https://github.com/andrewmcodes)) 193 | - fix obsolete configuration error in rubocop config [\#73](https://github.com/andrewmcodes/rubocop-linter-action/pull/73) ([andrewmcodes](https://github.com/andrewmcodes)) 194 | - Bugfix/respect rubocop level [\#72](https://github.com/andrewmcodes/rubocop-linter-action/pull/72) ([hackerdude](https://github.com/hackerdude)) 195 | - Fix version reference in README [\#65](https://github.com/andrewmcodes/rubocop-linter-action/pull/65) ([eregon](https://github.com/eregon)) 196 | - docs: add InteNs as a contributor [\#62](https://github.com/andrewmcodes/rubocop-linter-action/pull/62) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 197 | - docs: add chiefpansancolt as a contributor [\#61](https://github.com/andrewmcodes/rubocop-linter-action/pull/61) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 198 | 199 | ## [v2.0.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v2.0.0) (2019-11-22) 200 | 201 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.6...v2.0.0) 202 | 203 | **Merged pull requests:** 204 | 205 | - v2.0.0 release [\#60](https://github.com/andrewmcodes/rubocop-linter-action/pull/60) ([andrewmcodes](https://github.com/andrewmcodes)) 206 | - prep for v2.0 release [\#59](https://github.com/andrewmcodes/rubocop-linter-action/pull/59) ([andrewmcodes](https://github.com/andrewmcodes)) 207 | 208 | ## [v1.0.6](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.6) (2019-11-22) 209 | 210 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.5...v1.0.6) 211 | 212 | **Implemented enhancements:** 213 | 214 | - Use bundled version of rubocop instead of latest gems [\#48](https://github.com/andrewmcodes/rubocop-linter-action/issues/48) 215 | - \[Enhancement\] Add ability to use custom rubocop gem [\#45](https://github.com/andrewmcodes/rubocop-linter-action/issues/45) 216 | 217 | **Fixed bugs:** 218 | 219 | - Error when building [\#57](https://github.com/andrewmcodes/rubocop-linter-action/issues/57) 220 | 221 | **Merged pull requests:** 222 | 223 | - version bump to v1.0.6 [\#58](https://github.com/andrewmcodes/rubocop-linter-action/pull/58) ([andrewmcodes](https://github.com/andrewmcodes)) 224 | - add shell check linter [\#56](https://github.com/andrewmcodes/rubocop-linter-action/pull/56) ([andrewmcodes](https://github.com/andrewmcodes)) 225 | 226 | ## [v1.0.5](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.5) (2019-11-18) 227 | 228 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.4...v1.0.5) 229 | 230 | **Merged pull requests:** 231 | 232 | - version bump to v1.0.5 [\#54](https://github.com/andrewmcodes/rubocop-linter-action/pull/54) ([andrewmcodes](https://github.com/andrewmcodes)) 233 | - Add additional input params [\#53](https://github.com/andrewmcodes/rubocop-linter-action/pull/53) ([chiefpansancolt](https://github.com/chiefpansancolt)) 234 | 235 | ## [v1.0.4](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.4) (2019-11-15) 236 | 237 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.3...v1.0.4) 238 | 239 | **Implemented enhancements:** 240 | 241 | - \[suggestion\] offending cop name in annotation message [\#47](https://github.com/andrewmcodes/rubocop-linter-action/issues/47) 242 | 243 | **Closed issues:** 244 | 245 | - Create automated changelog [\#38](https://github.com/andrewmcodes/rubocop-linter-action/issues/38) 246 | 247 | **Merged pull requests:** 248 | 249 | - version bump to v1.0.4 [\#52](https://github.com/andrewmcodes/rubocop-linter-action/pull/52) ([andrewmcodes](https://github.com/andrewmcodes)) 250 | - docs: add reidab as a contributor [\#51](https://github.com/andrewmcodes/rubocop-linter-action/pull/51) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 251 | - docs: add bbugh as a contributor [\#50](https://github.com/andrewmcodes/rubocop-linter-action/pull/50) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 252 | - Add cop name to report messages [\#49](https://github.com/andrewmcodes/rubocop-linter-action/pull/49) ([bbugh](https://github.com/bbugh)) 253 | - Use 'notice' annotation style for refactor + convention offenses [\#46](https://github.com/andrewmcodes/rubocop-linter-action/pull/46) ([reidab](https://github.com/reidab)) 254 | - add changelog generator [\#44](https://github.com/andrewmcodes/rubocop-linter-action/pull/44) ([andrewmcodes](https://github.com/andrewmcodes)) 255 | 256 | ## [v1.0.3](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.3) (2019-11-07) 257 | 258 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.2...v1.0.3) 259 | 260 | **Fixed bugs:** 261 | 262 | - Receiving Unprocessable Entity on Version 1.0.1 when errors are present [\#40](https://github.com/andrewmcodes/rubocop-linter-action/issues/40) 263 | 264 | **Merged pull requests:** 265 | 266 | - v1.0.3 version bump [\#42](https://github.com/andrewmcodes/rubocop-linter-action/pull/42) ([andrewmcodes](https://github.com/andrewmcodes)) 267 | - only send GitHub offenses instead of entire json output [\#41](https://github.com/andrewmcodes/rubocop-linter-action/pull/41) ([andrewmcodes](https://github.com/andrewmcodes)) 268 | - Update issue templates [\#39](https://github.com/andrewmcodes/rubocop-linter-action/pull/39) ([andrewmcodes](https://github.com/andrewmcodes)) 269 | 270 | ## [v1.0.2](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.2) (2019-11-07) 271 | 272 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.1...v1.0.2) 273 | 274 | **Merged pull requests:** 275 | 276 | - v1.0.2 version bump [\#37](https://github.com/andrewmcodes/rubocop-linter-action/pull/37) ([andrewmcodes](https://github.com/andrewmcodes)) 277 | - docs: add amerritt14 as a contributor [\#36](https://github.com/andrewmcodes/rubocop-linter-action/pull/36) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 278 | - Fix typo, conslusion to conclusion [\#35](https://github.com/andrewmcodes/rubocop-linter-action/pull/35) ([amerritt14](https://github.com/amerritt14)) 279 | - add start and end column support [\#34](https://github.com/andrewmcodes/rubocop-linter-action/pull/34) ([andrewmcodes](https://github.com/andrewmcodes)) 280 | - update readme [\#33](https://github.com/andrewmcodes/rubocop-linter-action/pull/33) ([andrewmcodes](https://github.com/andrewmcodes)) 281 | - add action.yml and cleanup dockerfile [\#32](https://github.com/andrewmcodes/rubocop-linter-action/pull/32) ([andrewmcodes](https://github.com/andrewmcodes)) 282 | 283 | ## [v1.0.1](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.1) (2019-11-05) 284 | 285 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v1.0.0...v1.0.1) 286 | 287 | **Implemented enhancements:** 288 | 289 | - add ability to specify a path to a config file [\#27](https://github.com/andrewmcodes/rubocop-linter-action/issues/27) 290 | 291 | **Fixed bugs:** 292 | 293 | - Received Unprocessable Entity on version 1.0.0 [\#28](https://github.com/andrewmcodes/rubocop-linter-action/issues/28) 294 | 295 | **Merged pull requests:** 296 | 297 | - v1.0.1 version bump [\#31](https://github.com/andrewmcodes/rubocop-linter-action/pull/31) ([andrewmcodes](https://github.com/andrewmcodes)) 298 | - Update dockerfile and add build test action [\#30](https://github.com/andrewmcodes/rubocop-linter-action/pull/30) ([andrewmcodes](https://github.com/andrewmcodes)) 299 | - Do not send in an empty array of annotations on success [\#29](https://github.com/andrewmcodes/rubocop-linter-action/pull/29) ([andrewmcodes](https://github.com/andrewmcodes)) 300 | 301 | ## [v1.0.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v1.0.0) (2019-10-29) 302 | 303 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v0.2.0...v1.0.0) 304 | 305 | **Implemented enhancements:** 306 | 307 | - Add the rest of the rubocop gems [\#5](https://github.com/andrewmcodes/rubocop-linter-action/issues/5) 308 | - Refactor [\#2](https://github.com/andrewmcodes/rubocop-linter-action/issues/2) 309 | 310 | **Fixed bugs:** 311 | 312 | - Error when building [\#17](https://github.com/andrewmcodes/rubocop-linter-action/issues/17) 313 | - Unprocessable Entity when trying to update check [\#16](https://github.com/andrewmcodes/rubocop-linter-action/issues/16) 314 | 315 | **Closed issues:** 316 | 317 | - Results are not posted back to the original workflow [\#19](https://github.com/andrewmcodes/rubocop-linter-action/issues/19) 318 | 319 | **Merged pull requests:** 320 | 321 | - Release v1.0.0 [\#26](https://github.com/andrewmcodes/rubocop-linter-action/pull/26) ([andrewmcodes](https://github.com/andrewmcodes)) 322 | - docs: add mcgregordan as a contributor [\#25](https://github.com/andrewmcodes/rubocop-linter-action/pull/25) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 323 | - docs: add andrewmcodes as a contributor [\#24](https://github.com/andrewmcodes/rubocop-linter-action/pull/24) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 324 | - docs: add MiguelSavignano as a contributor [\#23](https://github.com/andrewmcodes/rubocop-linter-action/pull/23) ([allcontributors[bot]](https://github.com/apps/allcontributors)) 325 | - update docs [\#22](https://github.com/andrewmcodes/rubocop-linter-action/pull/22) ([andrewmcodes](https://github.com/andrewmcodes)) 326 | - add rspec and rubocop binstubs, and lint the project [\#21](https://github.com/andrewmcodes/rubocop-linter-action/pull/21) ([andrewmcodes](https://github.com/andrewmcodes)) 327 | - Refactor/files structure [\#20](https://github.com/andrewmcodes/rubocop-linter-action/pull/20) ([MiguelSavignano](https://github.com/MiguelSavignano)) 328 | 329 | ## [v0.2.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/v0.2.0) (2019-10-25) 330 | 331 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/v0.1.2...v0.2.0) 332 | 333 | **Fixed bugs:** 334 | 335 | - bugfixes [\#18](https://github.com/andrewmcodes/rubocop-linter-action/pull/18) ([andrewmcodes](https://github.com/andrewmcodes)) 336 | 337 | **Closed issues:** 338 | 339 | - Log failures as a comment on the PR? [\#6](https://github.com/andrewmcodes/rubocop-linter-action/issues/6) 340 | 341 | **Merged pull requests:** 342 | 343 | - Fix instructions [\#13](https://github.com/andrewmcodes/rubocop-linter-action/pull/13) ([mcgregordan](https://github.com/mcgregordan)) 344 | 345 | ## [v0.1.2](https://github.com/andrewmcodes/rubocop-linter-action/tree/v0.1.2) (2019-09-03) 346 | 347 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/0.1.1...v0.1.2) 348 | 349 | **Fixed bugs:** 350 | 351 | - unhandled exception error [\#1](https://github.com/andrewmcodes/rubocop-linter-action/issues/1) 352 | 353 | **Closed issues:** 354 | 355 | - Add community resources [\#4](https://github.com/andrewmcodes/rubocop-linter-action/issues/4) 356 | - Update documentation [\#3](https://github.com/andrewmcodes/rubocop-linter-action/issues/3) 357 | 358 | **Merged pull requests:** 359 | 360 | - add changelog [\#12](https://github.com/andrewmcodes/rubocop-linter-action/pull/12) ([andrewmcodes](https://github.com/andrewmcodes)) 361 | - update documentation [\#11](https://github.com/andrewmcodes/rubocop-linter-action/pull/11) ([andrewmcodes](https://github.com/andrewmcodes)) 362 | - add pull request template [\#10](https://github.com/andrewmcodes/rubocop-linter-action/pull/10) ([andrewmcodes](https://github.com/andrewmcodes)) 363 | - add contributing guide [\#9](https://github.com/andrewmcodes/rubocop-linter-action/pull/9) ([andrewmcodes](https://github.com/andrewmcodes)) 364 | - Update issue templates [\#8](https://github.com/andrewmcodes/rubocop-linter-action/pull/8) ([andrewmcodes](https://github.com/andrewmcodes)) 365 | - Create CODE\_OF\_CONDUCT.md [\#7](https://github.com/andrewmcodes/rubocop-linter-action/pull/7) ([andrewmcodes](https://github.com/andrewmcodes)) 366 | 367 | ## [0.1.1](https://github.com/andrewmcodes/rubocop-linter-action/tree/0.1.1) (2019-09-03) 368 | 369 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/0.1.0...0.1.1) 370 | 371 | ## [0.1.0](https://github.com/andrewmcodes/rubocop-linter-action/tree/0.1.0) (2019-09-03) 372 | 373 | [Full Changelog](https://github.com/andrewmcodes/rubocop-linter-action/compare/f412d3cc8311a4e94bf648b6b2f0d2f48678e143...0.1.0) 374 | 375 | 376 | 377 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 378 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at andrewmcodes@protonmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.7.0-alpine 2 | 3 | RUN apk --no-cache add build-base git 4 | 5 | COPY lib /action/lib 6 | COPY README.md LICENSE entrypoint.sh / 7 | 8 | RUN gem install bundler:2.1.4 9 | 10 | ENTRYPOINT ["/entrypoint.sh"] 11 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | group :development do 6 | gem "github_changelog_generator", "~> 1.15" 7 | gem "standard", "0.6" 8 | end 9 | 10 | group :test do 11 | gem "codecov", "~> 0.2", require: false 12 | gem "json", "~> 2.3" 13 | gem "pry" 14 | gem "rspec", "~> 3.9" 15 | gem "webmock", "~> 3.8" 16 | end 17 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | activesupport (6.0.3.3) 5 | concurrent-ruby (~> 1.0, >= 1.0.2) 6 | i18n (>= 0.7, < 2) 7 | minitest (~> 5.1) 8 | tzinfo (~> 1.1) 9 | zeitwerk (~> 2.2, >= 2.2.2) 10 | addressable (2.7.0) 11 | public_suffix (>= 2.0.2, < 5.0) 12 | ast (2.4.1) 13 | codecov (0.2.11) 14 | json 15 | simplecov 16 | coderay (1.1.3) 17 | concurrent-ruby (1.1.7) 18 | crack (0.4.3) 19 | safe_yaml (~> 1.0.0) 20 | diff-lcs (1.4.4) 21 | docile (1.3.2) 22 | faraday (1.0.1) 23 | multipart-post (>= 1.2, < 3) 24 | faraday-http-cache (2.2.0) 25 | faraday (>= 0.8) 26 | github_changelog_generator (1.15.2) 27 | activesupport 28 | faraday-http-cache 29 | multi_json 30 | octokit (~> 4.6) 31 | rainbow (>= 2.2.1) 32 | rake (>= 10.0) 33 | retriable (~> 3.0) 34 | hashdiff (1.0.1) 35 | i18n (1.8.5) 36 | concurrent-ruby (~> 1.0) 37 | json (2.3.1) 38 | method_source (1.0.0) 39 | minitest (5.14.2) 40 | multi_json (1.15.0) 41 | multipart-post (2.1.1) 42 | octokit (4.18.0) 43 | faraday (>= 0.9) 44 | sawyer (~> 0.8.0, >= 0.5.3) 45 | parallel (1.19.2) 46 | parser (2.7.1.4) 47 | ast (~> 2.4.1) 48 | pry (0.13.1) 49 | coderay (~> 1.1) 50 | method_source (~> 1.0) 51 | public_suffix (4.0.6) 52 | rainbow (3.0.0) 53 | rake (13.0.1) 54 | regexp_parser (1.7.1) 55 | retriable (3.1.2) 56 | rexml (3.2.4) 57 | rspec (3.9.0) 58 | rspec-core (~> 3.9.0) 59 | rspec-expectations (~> 3.9.0) 60 | rspec-mocks (~> 3.9.0) 61 | rspec-core (3.9.2) 62 | rspec-support (~> 3.9.3) 63 | rspec-expectations (3.9.2) 64 | diff-lcs (>= 1.2.0, < 2.0) 65 | rspec-support (~> 3.9.0) 66 | rspec-mocks (3.9.1) 67 | diff-lcs (>= 1.2.0, < 2.0) 68 | rspec-support (~> 3.9.0) 69 | rspec-support (3.9.3) 70 | rubocop (0.90.0) 71 | parallel (~> 1.10) 72 | parser (>= 2.7.1.1) 73 | rainbow (>= 2.2.2, < 4.0) 74 | regexp_parser (>= 1.7) 75 | rexml 76 | rubocop-ast (>= 0.3.0, < 1.0) 77 | ruby-progressbar (~> 1.7) 78 | unicode-display_width (>= 1.4.0, < 2.0) 79 | rubocop-ast (0.4.0) 80 | parser (>= 2.7.1.4) 81 | rubocop-performance (1.8.0) 82 | rubocop (>= 0.87.0) 83 | ruby-progressbar (1.10.1) 84 | safe_yaml (1.0.5) 85 | sawyer (0.8.2) 86 | addressable (>= 2.3.5) 87 | faraday (> 0.8, < 2.0) 88 | simplecov (0.19.0) 89 | docile (~> 1.1) 90 | simplecov-html (~> 0.11) 91 | simplecov-html (0.12.2) 92 | standard (0.6.0) 93 | rubocop (~> 0.90) 94 | rubocop-performance (~> 1.8.0) 95 | thread_safe (0.3.6) 96 | tzinfo (1.2.7) 97 | thread_safe (~> 0.1) 98 | unicode-display_width (1.7.0) 99 | webmock (3.8.3) 100 | addressable (>= 2.3.6) 101 | crack (>= 0.3.2) 102 | hashdiff (>= 0.4.0, < 2.0.0) 103 | zeitwerk (2.4.0) 104 | 105 | PLATFORMS 106 | ruby 107 | 108 | DEPENDENCIES 109 | codecov (~> 0.2) 110 | github_changelog_generator (~> 1.15) 111 | json (~> 2.3) 112 | pry 113 | rspec (~> 3.9) 114 | standard (= 0.6) 115 | webmock (~> 3.8) 116 | 117 | BUNDLED WITH 118 | 2.1.4 119 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2020 Andrew Mason 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [changelog]: /CHANGELOG.md 2 | [coc]: /CODE_OF_CONDUCT.md 3 | [contributing]: /CONTRIBUTING.md 4 | [license]: /LICENSE.md 5 | [image1]: /screenshots/check-overview.png 6 | [image2]: /screenshots/file-annotation.png 7 | [logo]: /screenshots/rubocop-linter-action.png 8 | [code-of-conduct]: CODE_OF_CONDUCT.md 9 | 10 | Hey, there! 👋 11 | 12 | This project is done in terms of features. If the project is severely broken due to a change in GitHub or RuboCop, it will be archived at that time and left to those that care about it to fork, fix, and maintain. 13 | 14 | I will be happy to review your pull request, but will not be adding any more myself, and make no guarantees I will accept anything that adds behavior. Please read the [introduction](#introduction) for my thoughts on why you should not use this action. 15 | 16 | This being said, I will be happy to give you contributor access if you're interested in becoming a maintainer. If I don't respond within a day or two through issues, you may email me (for this reason **only**) or DM me on [Twitter](https://twitter.com/andrewmcodes). Truthfully this project makes me feel very burnt out whenever I am around it, especially since I have not actually used it in months. 17 | 18 | Thanks for understanding, 19 | 20 | -- [@andrewmcodes](https://github.com/andrewmcodes) 21 | 22 | ![RuboCop Linter Action][logo] 23 | 24 | [![codecov](https://codecov.io/gh/andrewmcodes/rubocop-linter-action/branch/master/graph/badge.svg)](https://codecov.io/gh/andrewmcodes/rubocop-linter-action) 25 | [![CodeFactor](https://www.codefactor.io/repository/github/andrewmcodes/rubocop-linter-action/badge)](https://www.codefactor.io/repository/github/andrewmcodes/rubocop-linter-action) 26 | ![Linters](https://github.com/andrewmcodes/rubocop-linter-action/workflows/Linters/badge.svg) 27 | ![Tests](https://github.com/andrewmcodes/rubocop-linter-action/workflows/Test/badge.svg) 28 | [![Changelog](https://github.com/andrewmcodes/rubocop-linter-action/workflows/Changelog/badge.svg)][changelog] 29 | 30 | # RuboCop Linter Action 31 | 32 | RuboCop Linter Action is a GitHub Action to run [RuboCop](https://github.com/rubocop-hq/rubocop) against your Ruby codebase and output the results in the [GitHub Checks UI](https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/). 33 | 34 | > IMPORTANT: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array. 35 | 36 | This is straight out of [GitHub's documentation](https://docs.github.com/en/rest/reference/checks#create-a-check-run). 37 | 38 | Put simply, **this action will not work on pull requests from a forked repository**, making it basically useless for open source repositories. 39 | 40 | **PLEASE DO NOT USE THIS ACTION**, and instead follow [the Rails way](https://github.com/rails/rails/blob/4a78dcb326e57b5035c4df322e31875bfa74ae23/.github/workflows/rubocop.yml#L1). 41 | 42 | ## Quickstart 43 | 44 | > IMPORTANT: This action does not run `bundle install` by default. In order to install gems via bundler, you will need to update your configuration file. See more below. 45 | 46 | The default usage, similar to running `gem install rubocop && rubocop` from your command line: 47 | 48 | ```yaml 49 | - name: RuboCop Linter Action 50 | uses: andrewmcodes/rubocop-linter-action@v3.3.0 51 | env: 52 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 53 | ``` 54 | 55 | ## Introduction 56 | 57 | This GitHub Action provides a way to easily run RuboCop on your codebase, and output the results to the view via [GitHub Checks](https://docs.github.com/en/rest/reference/checks) 58 | 59 | While it is **recommended** to write a custom GitHub Action to run RuboCop on your codebase, this action takes that functionality one step further using Checks. After the RuboCop Linter Action runs RuboCop against your Ruby code, it will create annotations that you can easily view in the GitHub UI, matched up with the offending code. 60 | 61 | At this point the Checks API has been in beta over two years, and it is still possible that there will be breaking API changes that affect this action. If this occurs, please open a pull request to fix it. 62 | 63 | **Are you sure you need this action?** 64 | 65 | I would truly recommend **not** using this action. The potential for random breaking changes from GitHub will always be a looming threat and I have ascertained people are using this action as a crutch to avoid what they really ought be doing. 66 | 67 | If you find yourself constantly having to wade through RuboCop errors in GitHub, the fix is to not allow them to get to GitHub broken in the first place. I would highly suggest using a tool like [lefthook](https://github.com/Arkweid/lefthook) or similar to flag or fix failing cops before they get to GitHub Actions, saving you and your team time and removing the need for this action. 68 | 69 | ## Usage 70 | 71 | - [RuboCop Linter Action](#rubocop-linter-action) 72 | - [Quickstart](#quickstart) 73 | - [Introduction](#introduction) 74 | - [Usage](#usage) 75 | - [Screenshots](#screenshots) 76 | - [Configuration](#configuration) 77 | - [Inputs](#inputs) 78 | - [Simple Config](#simple-config) 79 | - [Default Config](#default-config) 80 | - [Version Constraints](#version-constraints) 81 | - [Spec](#spec) 82 | - [Usage](#usage-1) 83 | - [Example Workflow](#example-workflow) 84 | - [Updates](#updates) 85 | - [RuboCop Docs](#rubocop-docs) 86 | - [FAQ](#faq) 87 | - [Config options](#config-options) 88 | - [exit_on_failure](#exit_on_failure) 89 | - [Community](#community) 90 | - [Changelog](#changelog) 91 | - [Contributing](#contributing) 92 | - [Code of Conduct](#code-of-conduct) 93 | - [License](#license) 94 | 95 | ### Screenshots 96 | 97 | ![RuboCop Linter File Annotation][image2] 98 | 99 |
100 | Another Screenshot ⬇️ 101 | 102 | ![RuboCop Linter Checks Overview][image1] 103 | 104 |
105 | 106 | ### Configuration 107 | 108 | ### Inputs 109 | 110 | **`action_config_path`** 111 | 112 | **Defintion** 113 | 114 | The only input accepted for the action, which allows you to specify a custom location for the action config file. 115 | 116 | **Default** 117 | 118 | `.github/config/rubocop_linter_action.yml` 119 | 120 | ### Simple Config 121 | 122 | This is simple config file showing how you could choose to change the version numbers, but use defaults for the rest: 123 | 124 | ```yml 125 | # .github/config/rubocop_linter_action.yml 126 | 127 | versions: 128 | - rubocop-rails 129 | - rubocop-performance: "1.5.1" 130 | - rubocop-minitest: "latest" 131 | - rubocop-rspec: "1.37.0" 132 | ``` 133 | 134 | ### Default Config 135 | 136 | ```yml 137 | # .github/config/rubocop_linter_action.yml 138 | 139 | # Description: The name of the check that will be created. 140 | # Valid Options: A reasonably sized string. 141 | # Default: 'RuboCop Action' 142 | check_name: "RuboCop Results" 143 | 144 | # Description: Versions required to run your RuboCop checks. 145 | # Valid options: RuboCop and any RuboCop extension, by default the latest gem version will be used. You can explicitly state that 146 | # (not required) or use a version number, like '1.5.1'. 147 | # Default: 148 | # versions: 149 | # - rubocop: 'latest' 150 | versions: 151 | - rubocop 152 | - rubocop-rails 153 | - rubocop-minitest 154 | - rubocop-performance: "1.5.1" 155 | - rubocop-rspec: "1.37.0" 156 | 157 | # Description: RuboCop configuration file path relative to the workspace. 158 | # Valid options: A valid file path inside of the workspace. 159 | # Default: nil 160 | # Note: This does not need to be filled out for RuboCop to still find your config. 161 | # Resource: https://rubocop.readthedocs.io/en/stable/configuration/ 162 | rubocop_config_path: ".rubocop.yml" 163 | 164 | # Run all cops enabled by configuration except this list. 165 | # Valid options: list of valid cop(s) and/or departments. 166 | # Default: nil 167 | # Resource: https://rubocop.readthedocs.io/en/stable/cops/ 168 | rubocop_excluded_cops: 169 | - "Style/FrozenStringLiteralComment" 170 | 171 | # Minimum severity for exit with error code 172 | # Valid options: 'refactor', 'convention', 'warning', 'error', or 'fatal'. 173 | # Default: 'warning' 174 | # Resource: https://rubocop.readthedocs.io/en/stable/configuration/#severity 175 | rubocop_fail_level: "warning" 176 | 177 | # Whether or not to use --force-exclusion when building the rubocop command. Use this if you are only linting modified 178 | # files and typically excluded files have been changed. For example, if you exclude db/schema.rb in your rubocop.yml 179 | # but a change gets made, then with the check_scope config set to 'modified' rubocop will lint db/schema.rb. If you set 180 | # this to true, rubocop will ignore it. 181 | # Valid options: true || false 182 | # Default: false 183 | rubocop_force_exclusion: true 184 | 185 | # Instead of installing gems from rubygems, we can run `bundle install` on your project, 186 | # you would need to do this if you are using something like 'rubocop-github' or if you don't 187 | # want to list out dependencies with the `versions` key. 188 | # Valid options: true || false 189 | # Default: false 190 | bundle: false 191 | 192 | # The scope of code that RuboCop should lint. Use this if you only want to lint changed files. If this is not set 193 | # or not equal to 'modified', RuboCop is run against the entire codebase. Note that this will not work on the master branch. 194 | # Valid options: 'modified' 195 | # Default: nil 196 | check_scope: "modified" 197 | 198 | # The base branch against which changes will be compared, if check_scope config is set to 'modified'. 199 | # This setting is not used if check_scope != 'modified'. 200 | # Valid options: 'origin/another_branch' 201 | # Default: 'origin/master' 202 | base_branch: "origin/master" 203 | ``` 204 | 205 | ### Version Constraints 206 | 207 | It is **highly** recommend you tie yourself to a version and do not do the following. I promise your life will be much easier. 😇 208 | 209 | ```yml 210 | # ❌ Bad, use at your own risk! 211 | uses: andrewmcodes/rubocop-linter-action@master 212 | 213 | # ✅ Good 214 | uses: andrewmcodes/rubocop-linter-action@v2.0.0 215 | ``` 216 | 217 | ### Spec 218 | 219 | ```yml 220 | action_config_path: 221 | description: "Define a path to your optional action config file." 222 | required: false 223 | default: ".github/config/rubocop_linter_action.yml" 224 | ``` 225 | 226 | ### Usage 227 | 228 | ```yml 229 | with: 230 | action_config_path: ".github/actions/config/rubocop.yml" 231 | ``` 232 | 233 | ### Example Workflow 234 | 235 | Here is an example workflow file incorporating RuboCop Linter Action with customized usage based on the values in your configuration file: 236 | 237 | ```yaml 238 | name: Linters 239 | 240 | on: [push] 241 | 242 | jobs: 243 | build: 244 | runs-on: ubuntu-latest 245 | steps: 246 | - uses: actions/checkout@v1 247 | - name: RuboCop Linter 248 | uses: andrewmcodes/rubocop-linter-action@v3.3.0 249 | with: 250 | action_config_path: ".github/config/rubocop_linter_action.yml" # Note: this is the default location 251 | env: 252 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 253 | ``` 254 | 255 | ### Updates 256 | 257 | Since the action will default to the latest RuboCop release, you may run into isues with outdated config options that are specified in your `.rubocop.yml`. To easily upgrade your config, use [mry](https://github.com/pocke/mry). 258 | 259 | ### RuboCop Docs 260 | 261 | Several of the config options map directly to RuboCop's inputs. Check [their documentation](https://rubocop.readthedocs.io/en/stable/basic_usage/#command-line-flags) for help or more info. 262 | 263 | ### FAQ 264 | 265 | _If you cannot find an answer here that you think should be included, let us know!!_ 266 | 267 | **1. Why is my check result being shown under the wrong header?** 268 | 269 | There is a bug with Checks that might cause your runs to get jumbled in the UI, but they will all still run and render annotations in the diff correctly. Hopefully this will get fixed or we figure out that we are doing something wrong that is fixable. 270 | 271 | **2. How come I can't create checks on forked repositories? [(example)](https://github.com/ruby/spec/commit/1cfa9f188e8342993d149807210b6777189cfe3f/checks?check_suite_id=335929828)** 272 | 273 | > NOTE: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array. 274 | 275 | This is straight out of GitHub's documentation. Put simply, this action won't work correctly on pull requests from a forked repository as is. 276 | 277 | I am open to a PR that will just output the results of the RuboCop run to the actions log if someone would like to take a shot at adding that! 278 | 279 | **3. The modified flag is not working!** 280 | 281 | If you specify the following in your config file: 282 | 283 | ```yaml 284 | check_scope: "modified" 285 | ``` 286 | 287 | Please note that this will not work on commits to master. If you have an idea on how to make this work, please open an issue or PR! 288 | 289 | **4. My GitHub Checks results don't match the output of running RuboCop locally.** 290 | 291 | Make sure you're running the same version of RuboCop that the linter is using. If using Bundler, try running `bundle update rubocop`. If you need the linter to use an older version, you can specify it in the config file: 292 | 293 | ```yaml 294 | versions: 295 | - rubocop: "0.88.0" 296 | ``` 297 | 298 | ## Config options 299 | 300 | ### exit_on_failure 301 | 302 | Stop the workflow execution if the linter returns some failures. 303 | 304 | ```yaml 305 | - name: RuboCop Linter Action 306 | uses: andrewmcodes/rubocop-linter-action@v3.3.0 307 | with: 308 | exit_on_failure: true 309 | env: 310 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 311 | ``` 312 | 313 | ## Community 314 | 315 | ### Changelog 316 | 317 | [View our Changelog][changelog] 318 | 319 | ### Contributing 320 | 321 | If you would like to contribute, please limit to bug fixes. At this point, you will need to use your own fork if you want a big change in behavior. 322 | 323 | Please make sure to read the [code of conduct][code-of-conduct] before submitting issues or pull requests. 324 | 325 | To lend a helping hand: 326 | 327 | - [Fork the repository](https://help.github.com/articles/fork-a-repo/) 328 | - Make your desired changes 329 | - [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) 330 | - Ensure tests are passing 331 | 332 | Include `[ci skip]` in your commit message if the change does not change the meaning of code (e.g., documentation updates). 333 | 334 | ### Code of Conduct 335 | 336 | [Code of Conduct][coc] 337 | 338 | ### License 339 | 340 | [MIT][license] 341 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "RuboCop Linter Action" 2 | description: "A GitHub Action that lints your Ruby or Ruby on Rails code with RuboCop!" 3 | author: "Andrew Mason " 4 | inputs: 5 | action_config_path: 6 | description: "Define a path to your optional action config file." 7 | required: false 8 | default: ".github/config/rubocop_linter_action.yml" 9 | exit_on_failure: 10 | description: "Return exit code if linter returns some failures." 11 | required: false 12 | default: "true" 13 | runs: 14 | using: "docker" 15 | image: "Dockerfile" 16 | args: 17 | - ${{ inputs.action_config_path }} 18 | env: 19 | GITHUB_TOKEN: secrets.GITHUB_TOKEN 20 | branding: 21 | icon: "code" 22 | color: "red" 23 | -------------------------------------------------------------------------------- /bin/format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | system('bin/standardrb --fix --format progress') 5 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rspec' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("bundle", __dir__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rspec-core", "rspec") 30 | -------------------------------------------------------------------------------- /bin/standardrb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'standardrb' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("standard", "standardrb") 30 | -------------------------------------------------------------------------------- /bin/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | system("bin/rspec --format documentation") 5 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | parsers: 2 | v1: 3 | include_full_missed_files: true 4 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | ruby /action/lib/index.rb 6 | -------------------------------------------------------------------------------- /lib/command.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Command 4 | attr_reader :config 5 | 6 | def initialize(config) 7 | @config = config 8 | end 9 | 10 | def build 11 | return base_command unless config 12 | 13 | "#{check_scope} #{base_command} #{fail_level} #{rubocop_config} #{excluded} #{force_exclusion}".strip.squeeze(" ") 14 | end 15 | 16 | private 17 | 18 | def base_branch 19 | config.fetch("base_branch", "origin/master") 20 | end 21 | 22 | def base_command 23 | "rubocop --parallel -f json" 24 | end 25 | 26 | def check_scope 27 | return unless config["check_scope"] == "modified" 28 | 29 | "git diff #{base_branch}... --name-only --diff-filter=AM | xargs" 30 | end 31 | 32 | def rubocop_config 33 | rubocop_config = config.fetch("rubocop_config_path", "") 34 | "-c #{rubocop_config}" unless rubocop_config.empty? 35 | end 36 | 37 | def excluded 38 | excluded_cops = config.fetch("rubocop_excluded_cops", "") 39 | "--except #{excluded_cops.join(" ")}" unless excluded_cops.empty? 40 | end 41 | 42 | def fail_level 43 | level = config.fetch("rubocop_fail_level", "") 44 | "--fail-level #{level}" unless level.empty? 45 | end 46 | 47 | def force_exclusion 48 | force_exclusion = config.fetch("rubocop_force_exclusion", "").to_s 49 | "--force-exclusion" unless force_exclusion.empty? || force_exclusion == "false" 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /lib/configuration.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Configuration 4 | DEFAULT_CONFIG_PATH = ".github/config/rubocop_linter_action.yml" 5 | attr_reader :workspace 6 | 7 | def initialize(workspace) 8 | @workspace = workspace 9 | end 10 | 11 | def build 12 | Util.read_yaml("#{workspace}/#{config_path}") 13 | end 14 | 15 | private 16 | 17 | def config_path 18 | ENV["INPUT_ACTION_CONFIG_PATH"] || DEFAULT_CONFIG_PATH 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/github/check_run_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Github 4 | class CheckRunService 5 | SLICE_COUNT = 48 6 | attr_reader :report, :github_data, :report_adapter, :check_name, :results 7 | 8 | def initialize(report: nil, github_data: nil, report_adapter: nil, check_name: nil) 9 | @report = report 10 | @github_data = github_data 11 | @report_adapter = report_adapter 12 | @check_name = check_name 13 | end 14 | 15 | def run 16 | @results = report.build 17 | id, started_at = create_check 18 | update_check(id, started_at) 19 | complete_check(id, started_at) 20 | success? 21 | end 22 | 23 | private 24 | 25 | def create_check 26 | check = client.send_request( 27 | url: endpoint_url, 28 | method: "post", 29 | body: create_check_payload 30 | ) 31 | puts "Check run created with id: #{check["id"]}." 32 | [check["id"], check["started_at"]] 33 | end 34 | 35 | def update_check(id, started_at) 36 | annotations.each_slice(SLICE_COUNT) do |annotations_slice| 37 | client.send_request( 38 | url: "#{endpoint_url}/#{id}", 39 | method: "patch", 40 | body: update_check_payload(annotations_slice, started_at) 41 | ) 42 | puts "Updated check run with #{annotations_slice.count} annotations." 43 | end 44 | end 45 | 46 | def complete_check(id, started_at) 47 | request = client.send_request( 48 | url: "#{endpoint_url}/#{id}", 49 | method: "patch", 50 | body: completed_check_payload(started_at) 51 | ) 52 | puts "Completed check run." 53 | request 54 | end 55 | 56 | def client 57 | @client ||= Github::Client.new(github_data.token, user_agent: "rubocop-linter-action") 58 | end 59 | 60 | def summary 61 | report_adapter.summary(results) 62 | end 63 | 64 | def annotations 65 | report_adapter.annotations(results) 66 | end 67 | 68 | def conclusion 69 | report_adapter.conclusion(results) 70 | end 71 | 72 | def success? 73 | !report_adapter.failure?(results) 74 | end 75 | 76 | def endpoint_url 77 | "/repos/#{github_data.owner}/#{github_data.repo}/check-runs" 78 | end 79 | 80 | def base_payload(status) 81 | { 82 | name: check_name, 83 | head_sha: github_data.sha, 84 | status: status 85 | } 86 | end 87 | 88 | def create_check_payload 89 | base_payload("in_progress") 90 | end 91 | 92 | def completed_check_payload(started_at) 93 | base_payload("completed").merge!( 94 | conclusion: conclusion, 95 | started_at: started_at, 96 | completed_at: Time.now.iso8601 97 | ) 98 | end 99 | 100 | def update_check_payload(annotations, started_at) 101 | base_payload("in_progress").merge!( 102 | started_at: started_at, 103 | output: { 104 | title: check_name, 105 | summary: summary, 106 | annotations: annotations 107 | } 108 | ) 109 | end 110 | end 111 | end 112 | -------------------------------------------------------------------------------- /lib/github/client.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Github 4 | class Client 5 | attr_reader :github_token, :user_agent 6 | 7 | def initialize(github_token, user_agent: "ruby") 8 | @github_token = github_token 9 | @user_agent = user_agent 10 | end 11 | 12 | def send_request(url: "", method: "patch", body: {}, cancel_request: false) 13 | response = request_http { |http| 14 | if method == "patch" 15 | http.patch(url, body.to_json, headers) 16 | else 17 | http.post(url, body.to_json, headers) 18 | end 19 | } 20 | # Raise if this a request to cancel the check run to prevent a potential infinite loop 21 | raise "#{response.code}: #{response.message}: #{response.body}" if cancel_request 22 | 23 | message_handler(response: response, url: url) 24 | end 25 | 26 | private 27 | 28 | def headers 29 | @headers ||= { 30 | "Content-Type": "application/json", 31 | "Accept": "application/vnd.github.antiope-preview+json", 32 | "Authorization": "Bearer #{github_token}", 33 | "User-Agent": user_agent 34 | } 35 | end 36 | 37 | def request_http 38 | http = Net::HTTP.new("api.github.com", 443) 39 | http.use_ssl = true 40 | yield(http) 41 | end 42 | 43 | def message_handler(response: {}, url: nil) 44 | body = JSON.parse(response.body) 45 | # Patch requests should return 200, Post request should return 200 46 | # See: https://developer.github.com/v3/checks/runs/ 47 | return body if (response.code.to_i == 200) || (response.code.to_i == 201) 48 | 49 | # If request response code is not 200 || 201, send a request to cancel the check run suite. 50 | # See: https://bit.ly/2QLoFKx 51 | send_request( 52 | url: "#{url}/#{body["id"]}", 53 | body: cancel_suite_payload(body["name"], body["head_sha"]), 54 | cancel_request: true 55 | ) 56 | end 57 | 58 | def cancel_suite_payload(name, head_sha) 59 | { 60 | name: name, 61 | head_sha: head_sha, 62 | status: "completed", 63 | conclusion: "failure", 64 | completed_at: Time.now.iso8601 65 | } 66 | end 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lib/github/data.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Github 4 | class Data 5 | attr_reader :event 6 | 7 | def initialize(event) 8 | @event = event 9 | end 10 | 11 | def sha 12 | ENV["GITHUB_SHA"] 13 | end 14 | 15 | def token 16 | ENV["GITHUB_TOKEN"] 17 | end 18 | 19 | def owner 20 | ENV["GITHUB_REPOSITORY_OWNER"] || event.dig("repository", "owner", "login") 21 | end 22 | 23 | def repo 24 | ENV["GITHUB_REPOSITORY_NAME"] || event.dig("repository", "name") 25 | end 26 | 27 | def workspace 28 | ENV["GITHUB_WORKSPACE"] 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /lib/index.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # requires ................................................................... 4 | require "net/http" 5 | require "json" 6 | require "time" 7 | require "yaml" 8 | 9 | # require relatives .......................................................... 10 | require_relative "./configuration" 11 | require_relative "./command" 12 | require_relative "./github/check_run_service" 13 | require_relative "./github/client" 14 | require_relative "./github/data" 15 | require_relative "./install" 16 | require_relative "./report" 17 | require_relative "./report_adapter" 18 | require_relative "./results" 19 | require_relative "./util" 20 | 21 | class RubocopLinterAction 22 | def self.run 23 | new.run 24 | end 25 | 26 | def run 27 | install_gems 28 | run_check_run_service 29 | end 30 | 31 | private 32 | 33 | def config 34 | @config ||= Configuration.new(github_data.workspace).build 35 | end 36 | 37 | def github_data 38 | @github_data ||= Github::Data.new(Util.read_json(ENV["GITHUB_EVENT_PATH"])) 39 | end 40 | 41 | def install_gems 42 | Install.new(config).run 43 | end 44 | 45 | def command 46 | Command.new(config).build 47 | end 48 | 49 | def report 50 | Report.new(github_data, command) 51 | end 52 | 53 | def run_check_run_service 54 | Github::CheckRunService.new( 55 | report: report, 56 | github_data: github_data, 57 | report_adapter: ReportAdapter, 58 | check_name: check_name 59 | ).run 60 | end 61 | 62 | def check_name 63 | config.fetch("check_name", "RuboCop Action") 64 | end 65 | end 66 | 67 | success = RubocopLinterAction.run 68 | exit 1 if [true, "true"].include?(ENV["INPUT_EXIT_ON_FAILURE"]) && !success 69 | -------------------------------------------------------------------------------- /lib/install.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Install 4 | DEFAULT_DEPENDENCIES = { 5 | "rubocop" => "latest" 6 | }.freeze 7 | 8 | attr_reader :config 9 | 10 | def initialize(config) 11 | @config = Hash(config) 12 | end 13 | 14 | def run 15 | return system("bundle install") if config.fetch("bundle", false) 16 | 17 | system("gem install #{dependencies}") 18 | end 19 | 20 | private 21 | 22 | def dependencies 23 | DEFAULT_DEPENDENCIES.merge(custom_dependencies).map(&method(:version_string)).join(" ") 24 | end 25 | 26 | def custom_dependencies 27 | Hash[config.fetch("versions", []).map(&method(:version))] 28 | end 29 | 30 | def version(dependency) 31 | case dependency 32 | when Hash 33 | dependency.first 34 | else 35 | [dependency, "latest"] 36 | end 37 | end 38 | 39 | def version_string(dependency, version) 40 | version == "latest" ? dependency : "#{dependency}:#{version}" 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/report.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Report 4 | attr_reader :github_data, :command 5 | 6 | def initialize(github_data, command) 7 | @github_data = github_data 8 | @command = command 9 | end 10 | 11 | def build 12 | report_path ? Util.read_json(report_path) : results 13 | end 14 | 15 | private 16 | 17 | def report_path 18 | ENV["REPORT_PATH"] 19 | end 20 | 21 | def results 22 | Results.new(command).build 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/report_adapter.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ReportAdapter 4 | class << self 5 | CONCLUSION_TYPES = {failure: "failure", success: "success"}.freeze 6 | ANNOTATION_LEVELS = { 7 | "refactor" => "notice", 8 | "convention" => "notice", 9 | "warning" => "warning", 10 | "error" => "failure", 11 | "fatal" => "failure" 12 | }.freeze 13 | 14 | def conclusion(report) 15 | return CONCLUSION_TYPES[:failure] if failure?(report) 16 | 17 | CONCLUSION_TYPES[:success] 18 | end 19 | 20 | def failure?(report) 21 | status_code(report).positive? 22 | end 23 | 24 | def summary(report) 25 | "#{total_offenses(report)} offense(s) found." 26 | end 27 | 28 | def annotations(report) # rubocop:disable Metrics/AbcSize 29 | report["files"].each_with_object([]) do |file, annotation_list| 30 | file["offenses"].each do |offense| 31 | location, same_line = column_check(offense["location"]) 32 | annotation_list.push( 33 | { 34 | 'path': file["path"], 35 | 'start_line': location["start_line"], 36 | 'end_line': location["last_line"], 37 | 'start_column': (location["start_column"] if same_line), 38 | 'end_column': (location["last_column"] if same_line), 39 | 'annotation_level': annotation_level(offense["severity"]), 40 | 'message': "#{offense["message"]} [#{offense["cop_name"]}]" 41 | }.compact.transform_keys!(&:to_s) 42 | ) 43 | end 44 | end 45 | end 46 | 47 | private 48 | 49 | def column_check(location) 50 | same_line = location["start_line"] == location["last_line"] 51 | has_columns = location["start_column"] && location["last_column"] 52 | 53 | if same_line && has_columns && location["start_column"] > location["last_column"] 54 | location["start_column"], location["last_column"] = location["last_column"], location["start_column"] 55 | end 56 | 57 | [location, same_line] 58 | end 59 | 60 | def annotation_level(severity) 61 | ANNOTATION_LEVELS[severity] 62 | end 63 | 64 | def total_offenses(report) 65 | report.dig("summary", "offense_count") 66 | end 67 | 68 | def status_code(report) 69 | report.dig("__exit_code") 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /lib/results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "open3" 4 | 5 | class Results 6 | attr_accessor :output, :status_code 7 | 8 | def initialize(command) 9 | Open3.popen2(command) do |stdin, stdout, thread| 10 | stdin.close 11 | @output = stdout.read 12 | @status_code = thread.value.exitstatus 13 | end 14 | end 15 | 16 | def build 17 | insert_exit_code 18 | parsed_results 19 | end 20 | 21 | private 22 | 23 | def parsed_results 24 | @parsed_results ||= JSON.parse(output) 25 | end 26 | 27 | def insert_exit_code 28 | parsed_results["__exit_code"] = status_code 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/util.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Util 4 | class << self 5 | def read_json(path) 6 | JSON.parse(File.read(path)) 7 | rescue Errno::ENOENT 8 | p "Notice: No file: #{path}" 9 | {} 10 | end 11 | 12 | def read_yaml(path) 13 | YAML.safe_load(File.read(path)) 14 | rescue Errno::ENOENT 15 | p "Notice: No file: #{path}" 16 | {} 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /screenshots/check-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewmcodes-archive/rubocop-linter-action/aca5500a248f9c9f325b97f9694c5a186ac4c000/screenshots/check-overview.png -------------------------------------------------------------------------------- /screenshots/file-annotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewmcodes-archive/rubocop-linter-action/aca5500a248f9c9f325b97f9694c5a186ac4c000/screenshots/file-annotation.png -------------------------------------------------------------------------------- /screenshots/rubocop-linter-action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewmcodes-archive/rubocop-linter-action/aca5500a248f9c9f325b97f9694c5a186ac4c000/screenshots/rubocop-linter-action.png -------------------------------------------------------------------------------- /spec/command_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "./spec/spec_helper" 4 | 5 | describe Command do 6 | subject(:command) { Command.new(config) } 7 | 8 | describe "#build" do 9 | context "when config file exists" do 10 | let(:config) { YAML.safe_load(config_file) } 11 | 12 | context "with modified scope" do 13 | let(:config_file) do 14 | <<~YAML 15 | check_scope: modified 16 | YAML 17 | end 18 | 19 | context "when base_branch configuration option is specified" do 20 | let(:config_file) do 21 | <<~YAML 22 | base_branch: origin/develop 23 | check_scope: modified 24 | YAML 25 | end 26 | 27 | it "uses base_branch for diff" do 28 | expect(command.build).to eq( 29 | "git diff origin/develop... --name-only --diff-filter=AM | xargs "\ 30 | "rubocop --parallel -f json" 31 | ) 32 | end 33 | end 34 | 35 | context "when base_branch is not specified" do 36 | it "defaults to origin/master" do 37 | expect(command.build).to eq( 38 | "git diff origin/master... --name-only --diff-filter=AM | xargs "\ 39 | "rubocop --parallel -f json" 40 | ) 41 | end 42 | end 43 | end 44 | 45 | context "with fail_level config" do 46 | let(:config_file) do 47 | <<~YAML 48 | rubocop_fail_level: error 49 | YAML 50 | end 51 | 52 | it "sets fail_level flag" do 53 | expect(command.build).to eq("rubocop --parallel -f json --fail-level error") 54 | end 55 | end 56 | 57 | context "with custom rubocop config file" do 58 | let(:config_file) do 59 | <<~YAML 60 | rubocop_config_path: .rubocop.yml 61 | YAML 62 | end 63 | 64 | it "sets correct flag for custom file" do 65 | expect(command.build).to eq("rubocop --parallel -f json -c .rubocop.yml") 66 | end 67 | end 68 | 69 | context "with excluded cops specified" do 70 | let(:config_file) do 71 | <<~YAML 72 | rubocop_excluded_cops: 73 | - Style/FrozenStringLiteralComment 74 | YAML 75 | end 76 | 77 | it "excludes specified cops" do 78 | expect(command.build).to eq("rubocop --parallel -f json --except Style/FrozenStringLiteralComment") 79 | end 80 | end 81 | 82 | context "with force_exclusion config" do 83 | let(:config_file) do 84 | <<~YAML 85 | rubocop_force_exclusion: true 86 | YAML 87 | end 88 | 89 | it "sets force-exclusion flag" do 90 | expect(command.build).to eq("rubocop --parallel -f json --force-exclusion") 91 | end 92 | end 93 | 94 | context "with all options specified" do 95 | let(:config_file) { File.read("./spec/fixtures/config.yml") } 96 | 97 | it "returns built command" do 98 | expect(command.build).to eq( 99 | "git diff origin/develop... --name-only --diff-filter=AM | xargs "\ 100 | "rubocop --parallel -f json "\ 101 | "--fail-level error -c .rubocop.yml --except Style/FrozenStringLiteralComment --force-exclusion" 102 | ) 103 | end 104 | end 105 | end 106 | end 107 | 108 | context "when config file does not exist" do 109 | let(:config) { nil } 110 | 111 | it "returns base command" do 112 | expect(command.build).to eq("rubocop --parallel -f json") 113 | end 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /spec/fixtures/config.yml: -------------------------------------------------------------------------------- 1 | check_name: "RuboCop Results" 2 | versions: 3 | - rubocop 4 | - rubocop-rails 5 | - rubocop-performance: "1.5.1" 6 | - rubocop-minitest: "latest" 7 | - rubocop-rspec: "1.37.0" 8 | rubocop_config_path: ".rubocop.yml" 9 | rubocop_excluded_cops: 10 | - "Style/FrozenStringLiteralComment" 11 | rubocop_fail_level: "error" 12 | rubocop_force_exclusion: true 13 | bundle: false 14 | check_scope: "modified" 15 | base_branch: "origin/develop" 16 | -------------------------------------------------------------------------------- /spec/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "example": "json" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/example.yml: -------------------------------------------------------------------------------- 1 | example: "yaml" 2 | -------------------------------------------------------------------------------- /spec/fixtures/report.json: -------------------------------------------------------------------------------- 1 | { 2 | "__exit_code": 1, 3 | "metadata": { 4 | "rubocop_version": "0.79.0", 5 | "ruby_engine": "ruby", 6 | "ruby_version": "2.7.0", 7 | "ruby_patchlevel": "0", 8 | "ruby_platform": "x86_64-darwin19" 9 | }, 10 | "files": [ 11 | { 12 | "path": "Gemfile", 13 | "offenses": [ 14 | { 15 | "severity": "convention", 16 | "message": "Missing magic comment `# frozen_string_literal: true`.", 17 | "cop_name": "Style/FrozenStringLiteralComment", 18 | "corrected": false, 19 | "location": { 20 | "start_line": 1, 21 | "start_column": 1, 22 | "last_line": 1, 23 | "last_column": 1, 24 | "length": 1, 25 | "line": 1, 26 | "column": 1 27 | } 28 | }, 29 | { 30 | "severity": "convention", 31 | "message": "Final newline missing.", 32 | "cop_name": "Layout/TrailingBlankLines", 33 | "corrected": false, 34 | "location" :{ 35 | "start_line": 15, 36 | "start_column": 4, 37 | "last_line": 15, 38 | "last_column": 3, 39 | "length": 0, 40 | "line": 15, 41 | "column": 4 42 | } 43 | }, 44 | { 45 | "severity": "convention", 46 | "message": "Method has too many lines. [15/10]", 47 | "cop_name": "Metrics/MethodLength", 48 | "corrected": false, 49 | "location": { 50 | "start_line": 50, 51 | "start_column": 81, 52 | "last_line": 65, 53 | "last_column": 83, 54 | "length": 3, 55 | "line": 50, 56 | "column": 81 57 | } 58 | }, 59 | { 60 | "severity": "convention", 61 | "message": "Use `%i` or `%I` for an array of symbols.", 62 | "cop_name": "Style/SymbolArray", 63 | "corrected": false, 64 | "location": { 65 | "start_line": 51, 66 | "start_column": 28, 67 | "last_line": 51, 68 | "last_column": 53, 69 | "length": 26, 70 | "line": 51, 71 | "column": 28 72 | } 73 | }, 74 | { 75 | "severity": "convention", 76 | "message": "Line is too long. [98/80]", 77 | "cop_name": "Layout/LineLength", 78 | "corrected": false, 79 | "location": { 80 | "start_line": 55, 81 | "start_column": 81, 82 | "last_line": 55, 83 | "last_column": 98, 84 | "length": 18, 85 | "line": 55, 86 | "column": 81 87 | } 88 | }, 89 | { 90 | "severity": "convention", 91 | "message": "Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem `listen` should appear before `web-console`.", 92 | "cop_name": "Bundler/OrderedGems", 93 | "corrected": false, 94 | "location": { 95 | "start_line": 57, 96 | "start_column": 3, 97 | "last_line": 57, 98 | "last_column": 35, 99 | "length": 33, 100 | "line": 57, 101 | "column": 3 102 | } 103 | }, 104 | { 105 | "severity": "convention", 106 | "message": "Line is too long. [130/80]", 107 | "cop_name": "Layout/LineLength", 108 | "corrected": false, 109 | "location": { 110 | "start_line": 58, 111 | "start_column": 81, 112 | "last_line": 58, 113 | "last_column": 130, 114 | "length": 50, 115 | "line": 58, 116 | "column": 81 117 | } 118 | }, 119 | { 120 | "severity": "convention", 121 | "message": "Use `%i` or `%I` for an array of symbols.", 122 | "cop_name": "Style/SymbolArray", 123 | "corrected": false, 124 | "location": { 125 | "start_line": 72, 126 | "start_column": 31, 127 | "last_line": 72, 128 | "last_column": 66, 129 | "length": 36, 130 | "line": 72, 131 | "column": 31 132 | } 133 | } 134 | ] 135 | }, 136 | { 137 | "path": "Rakefile", 138 | "offenses": [ 139 | { 140 | "severity": "convention", 141 | "message": "Missing magic comment `# frozen_string_literal: true`.", 142 | "cop_name": "Style/FrozenStringLiteralComment", 143 | "corrected": false, 144 | "location": { 145 | "start_line": 1, 146 | "start_column": 1, 147 | "last_line": 1, 148 | "last_column": 1, 149 | "length": 1, 150 | "line": 1, 151 | "column": 1 152 | } 153 | }, 154 | { 155 | "severity": "convention", 156 | "message": "Line is too long. [90/80]", 157 | "cop_name": "Layout/LineLength", 158 | "corrected": false, 159 | "location": { 160 | "start_line": 2, 161 | "start_column": 81, 162 | "last_line": 2, 163 | "last_column": 90, 164 | "length": 10, 165 | "line": 2, 166 | "column": 81 167 | } 168 | } 169 | ] 170 | }, 171 | { 172 | "path": "app/channels/application_cable/channel.rb", 173 | "offenses": [ 174 | { 175 | "severity": "convention", 176 | "message": "Missing magic comment `# frozen_string_literal: true`.", 177 | "cop_name": "Style/FrozenStringLiteralComment", 178 | "corrected": false, 179 | "location": { 180 | "start_line": 1, 181 | "start_column": 1, 182 | "last_line": 1, 183 | "last_column": 1, 184 | "length": 1, 185 | "line": 1, 186 | "column": 1 187 | } 188 | } 189 | ] 190 | }, 191 | { 192 | "path": "app/channels/application_cable/connection.rb", 193 | "offenses": [ 194 | { 195 | "severity": "convention", 196 | "message": "Missing magic comment `# frozen_string_literal: true`.", 197 | "cop_name": "Style/FrozenStringLiteralComment", 198 | "corrected": false, 199 | "location": { 200 | "start_line": 1, 201 | "start_column": 1, 202 | "last_line": 1, 203 | "last_column": 1, 204 | "length": 1, 205 | "line": 1, 206 | "column": 1 207 | } 208 | } 209 | ] 210 | }, 211 | { 212 | "path": "app/controllers/application_controller.rb", 213 | "offenses": [ 214 | { 215 | "severity": "convention", 216 | "message": "Missing top-level class documentation comment.", 217 | "cop_name": "Style/Documentation", 218 | "corrected": false, 219 | "location": { 220 | "start_line": 1, 221 | "start_column": 1, 222 | "last_line": 1, 223 | "last_column": 5, 224 | "length": 5, 225 | "line": 1, 226 | "column": 1 227 | } 228 | }, 229 | { 230 | "severity": "convention", 231 | "message": "Missing magic comment `# frozen_string_literal: true`.", 232 | "cop_name": "Style/FrozenStringLiteralComment", 233 | "corrected": false, 234 | "location": { 235 | "start_line": 1, 236 | "start_column": 1, 237 | "last_line": 1, 238 | "last_column": 1, 239 | "length": 1, 240 | "line": 1, 241 | "column": 1 242 | } 243 | } 244 | ] 245 | }, 246 | { 247 | "path": "app/controllers/posts_controller.rb", 248 | "offenses": [ 249 | { 250 | "severity": "convention", 251 | "message": "Missing top-level class documentation comment.", 252 | "cop_name": "Style/Documentation", 253 | "corrected": false, 254 | "location": { 255 | "start_line": 1, 256 | "start_column": 1, 257 | "last_line": 1, 258 | "last_column": 5, 259 | "length": 5, 260 | "line": 1, 261 | "column": 1 262 | } 263 | }, 264 | { 265 | "severity": "convention", 266 | "message": "Missing magic comment `# frozen_string_literal: true`.", 267 | "cop_name": "Style/FrozenStringLiteralComment", 268 | "corrected": false, 269 | "location": { 270 | "start_line": 1, 271 | "start_column": 1, 272 | "last_line": 1, 273 | "last_column": 1, 274 | "length": 1, 275 | "line": 1, 276 | "column": 1 277 | } 278 | }, 279 | { 280 | "severity": "convention", 281 | "message": "Use `%i` or `%I` for an array of symbols.", 282 | "cop_name": "Style/SymbolArray", 283 | "corrected": false, 284 | "location": { 285 | "start_line": 2, 286 | "start_column": 34, 287 | "last_line": 2, 288 | "last_column": 66, 289 | "length": 33, 290 | "line": 2, 291 | "column": 34 292 | } 293 | }, 294 | { 295 | "severity": "convention", 296 | "message": "Put empty method definitions on a single line.", 297 | "cop_name": "Style/EmptyMethod", 298 | "corrected": false, 299 | "location": { 300 | "start_line": 12, 301 | "start_column": 3, 302 | "last_line": 13, 303 | "last_column": 5, 304 | "length": 14, 305 | "line": 12, 306 | "column": 3 307 | } 308 | }, 309 | { 310 | "severity": "convention", 311 | "message": "Put empty method definitions on a single line.", 312 | "cop_name": "Style/EmptyMethod", 313 | "corrected": false, 314 | "location": { 315 | "start_line": 21, 316 | "start_column": 3, 317 | "last_line": 22, 318 | "last_column": 5, 319 | "length": 14, 320 | "line": 21, 321 | "column": 3 322 | } 323 | }, 324 | { 325 | "severity": "convention", 326 | "message": "Line is too long. [83/80]", 327 | "cop_name": "Layout/LineLength", 328 | "corrected": false, 329 | "location": { 330 | "start_line": 31, 331 | "start_column": 81, 332 | "last_line": 31, 333 | "last_column": 83, 334 | "length": 3, 335 | "line": 31, 336 | "column": 81 337 | } 338 | }, 339 | { 340 | "severity": "convention", 341 | "message": "Line is too long. [83/80]", 342 | "cop_name": "Layout/LineLength", 343 | "corrected": false, 344 | "location": { 345 | "start_line": 45, 346 | "start_column": 81, 347 | "last_line": 45, 348 | "last_column": 83, 349 | "length": 3, 350 | "line": 45, 351 | "column": 81 352 | } 353 | }, 354 | { 355 | "severity": "convention", 356 | "message": "Line is too long. [87/80]", 357 | "cop_name": "Layout/LineLength", 358 | "corrected": false, 359 | "location": { 360 | "start_line": 59, 361 | "start_column": 81, 362 | "last_line": 59, 363 | "last_column": 87, 364 | "length": 7, 365 | "line": 59, 366 | "column": 81 367 | } 368 | }, 369 | { 370 | "severity": "convention", 371 | "message": "Keep a blank line before and after `private`.", 372 | "cop_name": "Layout/EmptyLinesAroundAccessModifier", 373 | "corrected": false, 374 | "location": { 375 | "start_line": 64, 376 | "start_column": 3, 377 | "last_line": 64, 378 | "last_column": 9, 379 | "length": 7, 380 | "line": 64, 381 | "column": 3 382 | } 383 | }, 384 | { 385 | "severity": "convention", 386 | "message": "Use 2 (not 4) spaces for indentation.", 387 | "cop_name": "Layout/IndentationWidth", 388 | "corrected": false, 389 | "location": { 390 | "start_line": 66, 391 | "start_column": 1, 392 | "last_line": 66, 393 | "last_column": 4, 394 | "length": 4, 395 | "line": 66, 396 | "column": 1 397 | } 398 | }, 399 | { 400 | "severity": "convention", 401 | "message": "Inconsistent indentation detected.", 402 | "cop_name": "Layout/IndentationConsistency", 403 | "corrected": false, 404 | "location": { 405 | "start_line": 66, 406 | "start_column": 5, 407 | "last_line": 68, 408 | "last_column": 7, 409 | "length": 57, 410 | "line": 66, 411 | "column": 5 412 | } 413 | }, 414 | { 415 | "severity": "convention", 416 | "message": "Line is too long. [88/80]", 417 | "cop_name": "Layout/LineLength", 418 | "corrected": false, 419 | "location": { 420 | "start_line": 70, 421 | "start_column": 81, 422 | "last_line": 70, 423 | "last_column": 88, 424 | "length": 8, 425 | "line": 70, 426 | "column": 81 427 | } 428 | }, 429 | { 430 | "severity": "convention", 431 | "message": "Use 2 (not 4) spaces for indentation.", 432 | "cop_name": "Layout/IndentationWidth", 433 | "corrected": false, 434 | "location": { 435 | "start_line": 71, 436 | "start_column": 1, 437 | "last_line": 71, 438 | "last_column": 4, 439 | "length": 4, 440 | "line": 71, 441 | "column": 1 442 | } 443 | }, 444 | { 445 | "severity": "convention", 446 | "message": "Inconsistent indentation detected.", 447 | "cop_name": "Layout/IndentationConsistency", 448 | "corrected": false, 449 | "location": { 450 | "start_line": 71, 451 | "start_column": 5, 452 | "last_line": 73, 453 | "last_column": 7, 454 | "length": 73, 455 | "line": 71, 456 | "column": 5 457 | } 458 | } 459 | ] 460 | }, 461 | { 462 | "path": "app/helpers/application_helper.rb", 463 | "offenses": [ 464 | { 465 | "severity": "convention", 466 | "message": "Missing top-level module documentation comment.", 467 | "cop_name": "Style/Documentation", 468 | "corrected": false, 469 | "location": { 470 | "start_line": 1, 471 | "start_column": 1, 472 | "last_line": 1, 473 | "last_column": 6, 474 | "length": 6, 475 | "line": 1, 476 | "column": 1 477 | } 478 | }, 479 | { 480 | "severity": "convention", 481 | "message": "Missing magic comment `# frozen_string_literal: true`.", 482 | "cop_name": "Style/FrozenStringLiteralComment", 483 | "corrected": false, 484 | "location": { 485 | "start_line": 1, 486 | "start_column": 1, 487 | "last_line": 1, 488 | "last_column": 1, 489 | "length": 1, 490 | "line": 1, 491 | "column": 1 492 | } 493 | } 494 | ] 495 | }, 496 | { 497 | "path": "app/helpers/posts_helper.rb", 498 | "offenses": [ 499 | { 500 | "severity": "convention", 501 | "message": "Missing top-level module documentation comment.", 502 | "cop_name": "Style/Documentation", 503 | "corrected": false, 504 | "location": { 505 | "start_line": 1, 506 | "start_column": 1, 507 | "last_line": 1, 508 | "last_column": 6, 509 | "length": 6, 510 | "line": 1, 511 | "column": 1 512 | } 513 | }, 514 | { 515 | "severity": "convention", 516 | "message": "Missing magic comment `# frozen_string_literal: true`.", 517 | "cop_name": "Style/FrozenStringLiteralComment", 518 | "corrected": false, 519 | "location": { 520 | "start_line": 1, 521 | "start_column": 1, 522 | "last_line": 1, 523 | "last_column": 1, 524 | "length": 1, 525 | "line": 1, 526 | "column": 1 527 | } 528 | } 529 | ] 530 | }, 531 | { 532 | "path": "app/jobs/application_job.rb", 533 | "offenses": [ 534 | { 535 | "severity": "convention", 536 | "message": "Missing top-level class documentation comment.", 537 | "cop_name": "Style/Documentation", 538 | "corrected": false, 539 | "location": { 540 | "start_line": 1, 541 | "start_column": 1, 542 | "last_line": 1, 543 | "last_column": 5, 544 | "length": 5, 545 | "line": 1, 546 | "column": 1 547 | } 548 | }, 549 | { 550 | "severity": "convention", 551 | "message": "Missing magic comment `# frozen_string_literal: true`.", 552 | "cop_name": "Style/FrozenStringLiteralComment", 553 | "corrected": false, 554 | "location": { 555 | "start_line": 1, 556 | "start_column": 1, 557 | "last_line": 1, 558 | "last_column": 1, 559 | "length": 1, 560 | "line": 1, 561 | "column": 1 562 | } 563 | } 564 | ] 565 | }, 566 | { 567 | "path": "app/jobs/post_count_word_job.rb", 568 | "offenses": [ 569 | { 570 | "severity": "convention", 571 | "message": "Missing top-level class documentation comment.", 572 | "cop_name": "Style/Documentation", 573 | "corrected": false, 574 | "location": { 575 | "start_line": 1, 576 | "start_column": 1, 577 | "last_line": 1, 578 | "last_column": 5, 579 | "length": 5, 580 | "line": 1, 581 | "column": 1 582 | } 583 | }, 584 | { 585 | "severity": "convention", 586 | "message": "Missing magic comment `# frozen_string_literal: true`.", 587 | "cop_name": "Style/FrozenStringLiteralComment", 588 | "corrected": false, 589 | "location": { 590 | "start_line": 1, 591 | "start_column": 1, 592 | "last_line": 1, 593 | "last_column": 1, 594 | "length": 1, 595 | "line": 1, 596 | "column": 1 597 | } 598 | } 599 | ] 600 | }, 601 | { 602 | "path": "app/mailers/application_mailer.rb", 603 | "offenses": [ 604 | { 605 | "severity": "convention", 606 | "message": "Missing top-level class documentation comment.", 607 | "cop_name": "Style/Documentation", 608 | "corrected": false, 609 | "location": { 610 | "start_line": 1, 611 | "start_column": 1, 612 | "last_line": 1, 613 | "last_column": 5, 614 | "length": 5, 615 | "line": 1, 616 | "column": 1 617 | } 618 | }, 619 | { 620 | "severity": "convention", 621 | "message": "Missing magic comment `# frozen_string_literal: true`.", 622 | "cop_name": "Style/FrozenStringLiteralComment", 623 | "corrected": false, 624 | "location": { 625 | "start_line": 1, 626 | "start_column": 1, 627 | "last_line": 1, 628 | "last_column": 1, 629 | "length": 1, 630 | "line": 1, 631 | "column": 1 632 | } 633 | } 634 | ] 635 | }, 636 | { 637 | "path": "app/models/application_record.rb", 638 | "offenses": [ 639 | { 640 | "severity": "convention", 641 | "message": "Missing top-level class documentation comment.", 642 | "cop_name": "Style/Documentation", 643 | "corrected": false, 644 | "location": { 645 | "start_line": 1, 646 | "start_column": 1, 647 | "last_line": 1, 648 | "last_column": 5, 649 | "length": 5, 650 | "line": 1, 651 | "column": 1 652 | } 653 | }, 654 | { 655 | "severity": "convention", 656 | "message": "Missing magic comment `# frozen_string_literal: true`.", 657 | "cop_name": "Style/FrozenStringLiteralComment", 658 | "corrected": false, 659 | "location": { 660 | "start_line": 1, 661 | "start_column": 1, 662 | "last_line": 1, 663 | "last_column": 1, 664 | "length": 1, 665 | "line": 1, 666 | "column": 1 667 | } 668 | } 669 | ] 670 | }, 671 | { 672 | "path": "app/models/post.rb", 673 | "offenses": [ 674 | { 675 | "severity": "convention", 676 | "message": "Missing top-level class documentation comment.", 677 | "cop_name": "Style/Documentation", 678 | "corrected": false, 679 | "location": { 680 | "start_line": 1, 681 | "start_column": 1, 682 | "last_line": 1, 683 | "last_column": 5, 684 | "length": 5, 685 | "line": 1, 686 | "column": 1 687 | } 688 | }, 689 | { 690 | "severity": "convention", 691 | "message": "Missing magic comment `# frozen_string_literal: true`.", 692 | "cop_name": "Style/FrozenStringLiteralComment", 693 | "corrected": false, 694 | "location": { 695 | "start_line": 1, 696 | "start_column": 1, 697 | "last_line": 1, 698 | "last_column": 1, 699 | "length": 1, 700 | "line": 1, 701 | "column": 1 702 | } 703 | }, 704 | { 705 | "severity": "convention", 706 | "message": "Redundant `self` detected.", 707 | "cop_name": "Style/RedundantSelf", 708 | "corrected": false, 709 | "location": { 710 | "start_line": 3, 711 | "start_column": 36, 712 | "last_line": 3, 713 | "last_column": 42, 714 | "length": 7, 715 | "line": 3, 716 | "column": 36 717 | } 718 | } 719 | ] 720 | }, 721 | { 722 | "path": "app/views/posts/_post.json.jbuilder", 723 | "offenses": [ 724 | { 725 | "severity": "convention", 726 | "message": "Missing magic comment `# frozen_string_literal: true`.", 727 | "cop_name": "Style/FrozenStringLiteralComment", 728 | "corrected": false, 729 | "location": { 730 | "start_line": 1, 731 | "start_column": 1, 732 | "last_line": 1, 733 | "last_column": 1, 734 | "length": 1, 735 | "line": 1, 736 | "column": 1 737 | } 738 | } 739 | ] 740 | }, 741 | { 742 | "path": "app/views/posts/index.json.jbuilder", 743 | "offenses": [ 744 | { 745 | "severity": "convention", 746 | "message": "Missing magic comment `# frozen_string_literal: true`.", 747 | "cop_name": "Style/FrozenStringLiteralComment", 748 | "corrected": false, 749 | "location": { 750 | "start_line": 1, 751 | "start_column": 1, 752 | "last_line": 1, 753 | "last_column": 1, 754 | "length": 1, 755 | "line": 1, 756 | "column": 1 757 | } 758 | } 759 | ] 760 | }, 761 | { 762 | "path": "app/views/posts/show.json.jbuilder", 763 | "offenses": [ 764 | { 765 | "severity": "convention", 766 | "message": "Missing magic comment `# frozen_string_literal: true`.", 767 | "cop_name": "Style/FrozenStringLiteralComment", 768 | "corrected": false, 769 | "location": { 770 | "start_line": 1, 771 | "start_column": 1, 772 | "last_line": 1, 773 | "last_column": 1, 774 | "length": 1, 775 | "line": 1, 776 | "column": 1 777 | } 778 | }, 779 | { 780 | "severity": "convention", 781 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 782 | "cop_name": "Style/StringLiterals", 783 | "corrected": false, 784 | "location": { 785 | "start_line": 1, 786 | "start_column": 15, 787 | "last_line": 1, 788 | "last_column": 26, 789 | "length": 12, 790 | "line": 1, 791 | "column": 15 792 | } 793 | } 794 | ] 795 | }, 796 | { 797 | "path": "bin/bundle", 798 | "offenses": [ 799 | { 800 | "severity": "convention", 801 | "message": "Missing magic comment `# frozen_string_literal: true`.", 802 | "cop_name": "Style/FrozenStringLiteralComment", 803 | "corrected": false, 804 | "location": { 805 | "start_line": 1, 806 | "start_column": 1, 807 | "last_line": 1, 808 | "last_column": 1, 809 | "length": 1, 810 | "line": 1, 811 | "column": 1 812 | } 813 | } 814 | ] 815 | }, 816 | { 817 | "path": "bin/rails", 818 | "offenses": [ 819 | { 820 | "severity": "convention", 821 | "message": "Missing magic comment `# frozen_string_literal: true`.", 822 | "cop_name": "Style/FrozenStringLiteralComment", 823 | "corrected": false, 824 | "location": { 825 | "start_line": 1, 826 | "start_column": 1, 827 | "last_line": 1, 828 | "last_column": 1, 829 | "length": 1, 830 | "line": 1, 831 | "column": 1 832 | } 833 | }, 834 | { 835 | "severity": "convention", 836 | "message": "Use `expand_path('spring', __dir__)` instead of `expand_path('../spring', __FILE__)`.", 837 | "cop_name": "Style/ExpandPathArguments", 838 | "corrected": false, 839 | "location": { 840 | "start_line": 3, 841 | "start_column": 13, 842 | "last_line": 3, 843 | "last_column": 23, 844 | "length": 11, 845 | "line": 3, 846 | "column": 13 847 | } 848 | } 849 | ] 850 | }, 851 | { 852 | "path": "bin/rake", 853 | "offenses": [ 854 | { 855 | "severity": "convention", 856 | "message": "Missing magic comment `# frozen_string_literal: true`.", 857 | "cop_name": "Style/FrozenStringLiteralComment", 858 | "corrected": false, 859 | "location": { 860 | "start_line": 1, 861 | "start_column": 1, 862 | "last_line": 1, 863 | "last_column": 1, 864 | "length": 1, 865 | "line": 1, 866 | "column": 1 867 | } 868 | }, 869 | { 870 | "severity": "convention", 871 | "message": "Use `expand_path('spring', __dir__)` instead of `expand_path('../spring', __FILE__)`.", 872 | "cop_name": "Style/ExpandPathArguments", 873 | "corrected": false, 874 | "location": { 875 | "start_line": 3, 876 | "start_column": 13, 877 | "last_line": 3, 878 | "last_column": 23, 879 | "length": 11, 880 | "line": 3, 881 | "column": 13 882 | } 883 | } 884 | ] 885 | }, 886 | { 887 | "path": "bin/setup", 888 | "offenses": [ 889 | { 890 | "severity": "convention", 891 | "message": "Missing magic comment `# frozen_string_literal: true`.", 892 | "cop_name": "Style/FrozenStringLiteralComment", 893 | "corrected": false, 894 | "location": { 895 | "start_line": 1, 896 | "start_column": 1, 897 | "last_line": 1, 898 | "last_column": 1, 899 | "length": 1, 900 | "line": 1, 901 | "column": 1 902 | } 903 | }, 904 | { 905 | "severity": "convention", 906 | "message": "`include` is used at the top level. Use inside `class` or `module`.", 907 | "cop_name": "Style/MixinUsage", 908 | "corrected": false, 909 | "location": { 910 | "start_line": 3, 911 | "start_column": 1, 912 | "last_line": 3, 913 | "last_column": 17, 914 | "length": 17, 915 | "line": 3, 916 | "column": 1 917 | } 918 | } 919 | ] 920 | }, 921 | { 922 | "path": "bin/spring", 923 | "offenses": [ 924 | { 925 | "severity": "convention", 926 | "message": "Missing magic comment `# frozen_string_literal: true`.", 927 | "cop_name": "Style/FrozenStringLiteralComment", 928 | "corrected": false, 929 | "location": { 930 | "start_line": 1, 931 | "start_column": 1, 932 | "last_line": 1, 933 | "last_column": 1, 934 | "length": 1, 935 | "line": 1, 936 | "column": 1 937 | } 938 | }, 939 | { 940 | "severity": "convention", 941 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 942 | "cop_name": "Style/StringLiterals", 943 | "corrected": false, 944 | "location": { 945 | "start_line": 11, 946 | "start_column": 56, 947 | "last_line": 11, 948 | "last_column": 63, 949 | "length": 8, 950 | "line": 11, 951 | "column": 56 952 | } 953 | } 954 | ] 955 | }, 956 | { 957 | "path": "bin/update", 958 | "offenses": [ 959 | { 960 | "severity": "convention", 961 | "message": "Missing magic comment `# frozen_string_literal: true`.", 962 | "cop_name": "Style/FrozenStringLiteralComment", 963 | "corrected": false, 964 | "location": { 965 | "start_line": 1, 966 | "start_column": 1, 967 | "last_line": 1, 968 | "last_column": 1, 969 | "length": 1, 970 | "line": 1, 971 | "column": 1 972 | } 973 | }, 974 | { 975 | "severity": "convention", 976 | "message": "`include` is used at the top level. Use inside `class` or `module`.", 977 | "cop_name": "Style/MixinUsage", 978 | "corrected": false, 979 | "location": { 980 | "start_line": 3, 981 | "start_column": 1, 982 | "last_line": 3, 983 | "last_column": 17, 984 | "length": 17, 985 | "line": 3, 986 | "column": 1 987 | } 988 | } 989 | ] 990 | }, 991 | { 992 | "path": "bin/webpack", 993 | "offenses": [ 994 | { 995 | "severity": "convention", 996 | "message": "Missing magic comment `# frozen_string_literal: true`.", 997 | "cop_name": "Style/FrozenStringLiteralComment", 998 | "corrected": false, 999 | "location": { 1000 | "start_line": 1, 1001 | "start_column": 1, 1002 | "last_line": 1, 1003 | "last_column": 1, 1004 | "length": 1, 1005 | "line": 1, 1006 | "column": 1 1007 | } 1008 | }, 1009 | { 1010 | "severity": "convention", 1011 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1012 | "cop_name": "Style/StringLiterals", 1013 | "corrected": false, 1014 | "location": { 1015 | "start_line": 3, 1016 | "start_column": 5, 1017 | "last_line": 3, 1018 | "last_column": 15, 1019 | "length": 11, 1020 | "line": 3, 1021 | "column": 5 1022 | } 1023 | }, 1024 | { 1025 | "severity": "convention", 1026 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1027 | "cop_name": "Style/StringLiterals", 1028 | "corrected": false, 1029 | "location": { 1030 | "start_line": 3, 1031 | "start_column": 26, 1032 | "last_line": 3, 1033 | "last_column": 35, 1034 | "length": 10, 1035 | "line": 3, 1036 | "column": 26 1037 | } 1038 | }, 1039 | { 1040 | "severity": "convention", 1041 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1042 | "cop_name": "Style/StringLiterals", 1043 | "corrected": false, 1044 | "location": { 1045 | "start_line": 3, 1046 | "start_column": 41, 1047 | "last_line": 3, 1048 | "last_column": 53, 1049 | "length": 13, 1050 | "line": 3, 1051 | "column": 41 1052 | } 1053 | }, 1054 | { 1055 | "severity": "convention", 1056 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1057 | "cop_name": "Style/StringLiterals", 1058 | "corrected": false, 1059 | "location": { 1060 | "start_line": 4, 1061 | "start_column": 5, 1062 | "last_line": 4, 1063 | "last_column": 14, 1064 | "length": 10, 1065 | "line": 4, 1066 | "column": 5 1067 | } 1068 | }, 1069 | { 1070 | "severity": "convention", 1071 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1072 | "cop_name": "Style/StringLiterals", 1073 | "corrected": false, 1074 | "location": { 1075 | "start_line": 4, 1076 | "start_column": 22, 1077 | "last_line": 4, 1078 | "last_column": 34, 1079 | "length": 13, 1080 | "line": 4, 1081 | "column": 22 1082 | } 1083 | }, 1084 | { 1085 | "severity": "convention", 1086 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1087 | "cop_name": "Style/StringLiterals", 1088 | "corrected": false, 1089 | "location": { 1090 | "start_line": 6, 1091 | "start_column": 9, 1092 | "last_line": 6, 1093 | "last_column": 18, 1094 | "length": 10, 1095 | "line": 6, 1096 | "column": 9 1097 | } 1098 | }, 1099 | { 1100 | "severity": "convention", 1101 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1102 | "cop_name": "Style/StringLiterals", 1103 | "corrected": false, 1104 | "location": { 1105 | "start_line": 7, 1106 | "start_column": 5, 1107 | "last_line": 7, 1108 | "last_column": 20, 1109 | "length": 16, 1110 | "line": 7, 1111 | "column": 5 1112 | } 1113 | }, 1114 | { 1115 | "severity": "convention", 1116 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1117 | "cop_name": "Style/StringLiterals", 1118 | "corrected": false, 1119 | "location": { 1120 | "start_line": 7, 1121 | "start_column": 44, 1122 | "last_line": 7, 1123 | "last_column": 58, 1124 | "length": 15, 1125 | "line": 7, 1126 | "column": 44 1127 | } 1128 | }, 1129 | { 1130 | "severity": "convention", 1131 | "message": "Align the arguments of a method call if they span more than one line.", 1132 | "cop_name": "Layout/AlignArguments", 1133 | "corrected": false, 1134 | "location": { 1135 | "start_line": 8, 1136 | "start_column": 3, 1137 | "last_line": 8, 1138 | "last_column": 33, 1139 | "length": 31, 1140 | "line": 8, 1141 | "column": 3 1142 | } 1143 | }, 1144 | { 1145 | "severity": "convention", 1146 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1147 | "cop_name": "Style/StringLiterals", 1148 | "corrected": false, 1149 | "location": { 1150 | "start_line": 10, 1151 | "start_column": 9, 1152 | "last_line": 10, 1153 | "last_column": 18, 1154 | "length": 10, 1155 | "line": 10, 1156 | "column": 9 1157 | } 1158 | }, 1159 | { 1160 | "severity": "convention", 1161 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1162 | "cop_name": "Style/StringLiterals", 1163 | "corrected": false, 1164 | "location": { 1165 | "start_line": 11, 1166 | "start_column": 9, 1167 | "last_line": 11, 1168 | "last_column": 23, 1169 | "length": 15, 1170 | "line": 11, 1171 | "column": 9 1172 | } 1173 | }, 1174 | { 1175 | "severity": "convention", 1176 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1177 | "cop_name": "Style/StringLiterals", 1178 | "corrected": false, 1179 | "location": { 1180 | "start_line": 13, 1181 | "start_column": 9, 1182 | "last_line": 13, 1183 | "last_column": 19, 1184 | "length": 11, 1185 | "line": 13, 1186 | "column": 9 1187 | } 1188 | }, 1189 | { 1190 | "severity": "convention", 1191 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1192 | "cop_name": "Style/StringLiterals", 1193 | "corrected": false, 1194 | "location": { 1195 | "start_line": 14, 1196 | "start_column": 9, 1197 | "last_line": 14, 1198 | "last_column": 34, 1199 | "length": 26, 1200 | "line": 14, 1201 | "column": 9 1202 | } 1203 | } 1204 | ] 1205 | }, 1206 | { 1207 | "path": "bin/webpack-dev-server", 1208 | "offenses": [ 1209 | { 1210 | "severity": "convention", 1211 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1212 | "cop_name": "Style/FrozenStringLiteralComment", 1213 | "corrected": false, 1214 | "location": { 1215 | "start_line": 1, 1216 | "start_column": 1, 1217 | "last_line": 1, 1218 | "last_column": 1, 1219 | "length": 1, 1220 | "line": 1, 1221 | "column": 1 1222 | } 1223 | }, 1224 | { 1225 | "severity": "convention", 1226 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1227 | "cop_name": "Style/StringLiterals", 1228 | "corrected": false, 1229 | "location": { 1230 | "start_line": 3, 1231 | "start_column": 5, 1232 | "last_line": 3, 1233 | "last_column": 15, 1234 | "length": 11, 1235 | "line": 3, 1236 | "column": 5 1237 | } 1238 | }, 1239 | { 1240 | "severity": "convention", 1241 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1242 | "cop_name": "Style/StringLiterals", 1243 | "corrected": false, 1244 | "location": { 1245 | "start_line": 3, 1246 | "start_column": 26, 1247 | "last_line": 3, 1248 | "last_column": 35, 1249 | "length": 10, 1250 | "line": 3, 1251 | "column": 26 1252 | } 1253 | }, 1254 | { 1255 | "severity": "convention", 1256 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1257 | "cop_name": "Style/StringLiterals", 1258 | "corrected": false, 1259 | "location": { 1260 | "start_line": 3, 1261 | "start_column": 41, 1262 | "last_line": 3, 1263 | "last_column": 53, 1264 | "length": 13, 1265 | "line": 3, 1266 | "column": 41 1267 | } 1268 | }, 1269 | { 1270 | "severity": "convention", 1271 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1272 | "cop_name": "Style/StringLiterals", 1273 | "corrected": false, 1274 | "location": { 1275 | "start_line": 4, 1276 | "start_column": 5, 1277 | "last_line": 4, 1278 | "last_column": 14, 1279 | "length": 10, 1280 | "line": 4, 1281 | "column": 5 1282 | } 1283 | }, 1284 | { 1285 | "severity": "convention", 1286 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1287 | "cop_name": "Style/StringLiterals", 1288 | "corrected": false, 1289 | "location": { 1290 | "start_line": 4, 1291 | "start_column": 22, 1292 | "last_line": 4, 1293 | "last_column": 34, 1294 | "length": 13, 1295 | "line": 4, 1296 | "column": 22 1297 | } 1298 | }, 1299 | { 1300 | "severity": "convention", 1301 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1302 | "cop_name": "Style/StringLiterals", 1303 | "corrected": false, 1304 | "location": { 1305 | "start_line": 6, 1306 | "start_column": 9, 1307 | "last_line": 6, 1308 | "last_column": 18, 1309 | "length": 10, 1310 | "line": 6, 1311 | "column": 9 1312 | } 1313 | }, 1314 | { 1315 | "severity": "convention", 1316 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1317 | "cop_name": "Style/StringLiterals", 1318 | "corrected": false, 1319 | "location": { 1320 | "start_line": 7, 1321 | "start_column": 5, 1322 | "last_line": 7, 1323 | "last_column": 20, 1324 | "length": 16, 1325 | "line": 7, 1326 | "column": 5 1327 | } 1328 | }, 1329 | { 1330 | "severity": "convention", 1331 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1332 | "cop_name": "Style/StringLiterals", 1333 | "corrected": false, 1334 | "location": { 1335 | "start_line": 7, 1336 | "start_column": 44, 1337 | "last_line": 7, 1338 | "last_column": 58, 1339 | "length": 15, 1340 | "line": 7, 1341 | "column": 44 1342 | } 1343 | }, 1344 | { 1345 | "severity": "convention", 1346 | "message": "Align the arguments of a method call if they span more than one line.", 1347 | "cop_name": "Layout/AlignArguments", 1348 | "corrected": false, 1349 | "location": { 1350 | "start_line": 8, 1351 | "start_column": 3, 1352 | "last_line": 8, 1353 | "last_column": 33, 1354 | "length": 31, 1355 | "line": 8, 1356 | "column": 3 1357 | } 1358 | }, 1359 | { 1360 | "severity": "convention", 1361 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1362 | "cop_name": "Style/StringLiterals", 1363 | "corrected": false, 1364 | "location": { 1365 | "start_line": 10, 1366 | "start_column": 9, 1367 | "last_line": 10, 1368 | "last_column": 18, 1369 | "length": 10, 1370 | "line": 10, 1371 | "column": 9 1372 | } 1373 | }, 1374 | { 1375 | "severity": "convention", 1376 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1377 | "cop_name": "Style/StringLiterals", 1378 | "corrected": false, 1379 | "location": { 1380 | "start_line": 11, 1381 | "start_column": 9, 1382 | "last_line": 11, 1383 | "last_column": 23, 1384 | "length": 15, 1385 | "line": 11, 1386 | "column": 9 1387 | } 1388 | }, 1389 | { 1390 | "severity": "convention", 1391 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1392 | "cop_name": "Style/StringLiterals", 1393 | "corrected": false, 1394 | "location": { 1395 | "start_line": 13, 1396 | "start_column": 9, 1397 | "last_line": 13, 1398 | "last_column": 19, 1399 | "length": 11, 1400 | "line": 13, 1401 | "column": 9 1402 | } 1403 | }, 1404 | { 1405 | "severity": "convention", 1406 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1407 | "cop_name": "Style/StringLiterals", 1408 | "corrected": false, 1409 | "location": { 1410 | "start_line": 14, 1411 | "start_column": 9, 1412 | "last_line": 14, 1413 | "last_column": 37, 1414 | "length": 29, 1415 | "line": 14, 1416 | "column": 9 1417 | } 1418 | } 1419 | ] 1420 | }, 1421 | { 1422 | "path": "bin/yarn", 1423 | "offenses": [ 1424 | { 1425 | "severity": "convention", 1426 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1427 | "cop_name": "Style/FrozenStringLiteralComment", 1428 | "corrected": false, 1429 | "location": { 1430 | "start_line": 1, 1431 | "start_column": 1, 1432 | "last_line": 1, 1433 | "last_column": 1, 1434 | "length": 1, 1435 | "line": 1, 1436 | "column": 1 1437 | } 1438 | }, 1439 | { 1440 | "severity": "convention", 1441 | "message": "Redundant `begin` block detected.", 1442 | "cop_name": "Style/RedundantBegin", 1443 | "corrected": false, 1444 | "location": { 1445 | "start_line": 4, 1446 | "start_column": 3, 1447 | "last_line": 4, 1448 | "last_column": 7, 1449 | "length": 5, 1450 | "line": 4, 1451 | "column": 3 1452 | } 1453 | }, 1454 | { 1455 | "severity": "convention", 1456 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1457 | "cop_name": "Style/StringLiterals", 1458 | "corrected": false, 1459 | "location": { 1460 | "start_line": 5, 1461 | "start_column": 10, 1462 | "last_line": 5, 1463 | "last_column": 18, 1464 | "length": 9, 1465 | "line": 5, 1466 | "column": 10 1467 | } 1468 | }, 1469 | { 1470 | "severity": "convention", 1471 | "message": "Use `warn` instead of `$stderr.puts` to allow such output to be disabled.", 1472 | "cop_name": "Style/StderrPuts", 1473 | "corrected": false, 1474 | "location": { 1475 | "start_line": 7, 1476 | "start_column": 5, 1477 | "last_line": 7, 1478 | "last_column": 16, 1479 | "length": 12, 1480 | "line": 7, 1481 | "column": 5 1482 | } 1483 | }, 1484 | { 1485 | "severity": "convention", 1486 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1487 | "cop_name": "Style/StringLiterals", 1488 | "corrected": false, 1489 | "location": { 1490 | "start_line": 7, 1491 | "start_column": 18, 1492 | "last_line": 7, 1493 | "last_column": 66, 1494 | "length": 49, 1495 | "line": 7, 1496 | "column": 18 1497 | } 1498 | }, 1499 | { 1500 | "severity": "convention", 1501 | "message": "Use `warn` instead of `$stderr.puts` to allow such output to be disabled.", 1502 | "cop_name": "Style/StderrPuts", 1503 | "corrected": false, 1504 | "location": { 1505 | "start_line": 8, 1506 | "start_column": 5, 1507 | "last_line": 8, 1508 | "last_column": 16, 1509 | "length": 12, 1510 | "line": 8, 1511 | "column": 5 1512 | } 1513 | }, 1514 | { 1515 | "severity": "convention", 1516 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1517 | "cop_name": "Style/StringLiterals", 1518 | "corrected": false, 1519 | "location": { 1520 | "start_line": 8, 1521 | "start_column": 18, 1522 | "last_line": 8, 1523 | "last_column": 71, 1524 | "length": 54, 1525 | "line": 8, 1526 | "column": 18 1527 | } 1528 | } 1529 | ] 1530 | }, 1531 | { 1532 | "path": "config.ru", 1533 | "offenses": [ 1534 | { 1535 | "severity": "convention", 1536 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1537 | "cop_name": "Style/FrozenStringLiteralComment", 1538 | "corrected": false, 1539 | "location": { 1540 | "start_line": 1, 1541 | "start_column": 1, 1542 | "last_line": 1, 1543 | "last_column": 1, 1544 | "length": 1, 1545 | "line": 1, 1546 | "column": 1 1547 | } 1548 | } 1549 | ] 1550 | }, 1551 | { 1552 | "path": "config/application.rb", 1553 | "offenses": [ 1554 | { 1555 | "severity": "convention", 1556 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1557 | "cop_name": "Style/FrozenStringLiteralComment", 1558 | "corrected": false, 1559 | "location": { 1560 | "start_line": 1, 1561 | "start_column": 1, 1562 | "last_line": 1, 1563 | "last_column": 1, 1564 | "length": 1, 1565 | "line": 1, 1566 | "column": 1 1567 | } 1568 | }, 1569 | { 1570 | "severity": "convention", 1571 | "message": "Missing top-level class documentation comment.", 1572 | "cop_name": "Style/Documentation", 1573 | "corrected": false, 1574 | "location": { 1575 | "start_line": 10, 1576 | "start_column": 3, 1577 | "last_line": 10, 1578 | "last_column": 7, 1579 | "length": 5, 1580 | "line": 10, 1581 | "column": 3 1582 | } 1583 | }, 1584 | { 1585 | "severity": "convention", 1586 | "message": "Line is too long. [82/80]", 1587 | "cop_name": "Layout/LineLength", 1588 | "corrected": false, 1589 | "location": { 1590 | "start_line": 14, 1591 | "start_column": 81, 1592 | "last_line": 14, 1593 | "last_column": 82, 1594 | "length": 2, 1595 | "line": 14, 1596 | "column": 81 1597 | } 1598 | } 1599 | ] 1600 | }, 1601 | { 1602 | "path": "config/boot.rb", 1603 | "offenses": [ 1604 | { 1605 | "severity": "convention", 1606 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1607 | "cop_name": "Style/FrozenStringLiteralComment", 1608 | "corrected": false, 1609 | "location": { 1610 | "start_line": 1, 1611 | "start_column": 1, 1612 | "last_line": 1, 1613 | "last_column": 1, 1614 | "length": 1, 1615 | "line": 1, 1616 | "column": 1 1617 | } 1618 | } 1619 | ] 1620 | }, 1621 | { 1622 | "path": "config/environment.rb", 1623 | "offenses": [ 1624 | { 1625 | "severity": "convention", 1626 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1627 | "cop_name": "Style/FrozenStringLiteralComment", 1628 | "corrected": false, 1629 | "location": { 1630 | "start_line": 1, 1631 | "start_column": 1, 1632 | "last_line": 1, 1633 | "last_column": 1, 1634 | "length": 1, 1635 | "line": 1, 1636 | "column": 1 1637 | } 1638 | } 1639 | ] 1640 | }, 1641 | { 1642 | "path": "config/environments/development.rb", 1643 | "offenses": [ 1644 | { 1645 | "severity": "convention", 1646 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1647 | "cop_name": "Style/FrozenStringLiteralComment", 1648 | "corrected": false, 1649 | "location": { 1650 | "start_line": 1, 1651 | "start_column": 1, 1652 | "last_line": 1, 1653 | "last_column": 1, 1654 | "length": 1, 1655 | "line": 1, 1656 | "column": 1 1657 | } 1658 | }, 1659 | { 1660 | "severity": "convention", 1661 | "message": "Line is too long. [97/80]", 1662 | "cop_name": "Layout/LineLength", 1663 | "corrected": false, 1664 | "location": { 1665 | "start_line": 2, 1666 | "start_column": 81, 1667 | "last_line": 2, 1668 | "last_column": 97, 1669 | "length": 17, 1670 | "line": 2, 1671 | "column": 81 1672 | } 1673 | }, 1674 | { 1675 | "severity": "convention", 1676 | "message": "Line is too long. [85/80]", 1677 | "cop_name": "Layout/LineLength", 1678 | "corrected": false, 1679 | "location": { 1680 | "start_line": 4, 1681 | "start_column": 81, 1682 | "last_line": 4, 1683 | "last_column": 85, 1684 | "length": 5, 1685 | "line": 4, 1686 | "column": 81 1687 | } 1688 | }, 1689 | { 1690 | "severity": "convention", 1691 | "message": "Line is too long. [86/80]", 1692 | "cop_name": "Layout/LineLength", 1693 | "corrected": false, 1694 | "location": { 1695 | "start_line": 32, 1696 | "start_column": 81, 1697 | "last_line": 32, 1698 | "last_column": 86, 1699 | "length": 6, 1700 | "line": 32, 1701 | "column": 81 1702 | } 1703 | } 1704 | ] 1705 | }, 1706 | { 1707 | "path": "config/environments/production.rb", 1708 | "offenses": [ 1709 | { 1710 | "severity": "convention", 1711 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1712 | "cop_name": "Style/FrozenStringLiteralComment", 1713 | "corrected": false, 1714 | "location": { 1715 | "start_line": 1, 1716 | "start_column": 1, 1717 | "last_line": 1, 1718 | "last_column": 1, 1719 | "length": 1, 1720 | "line": 1, 1721 | "column": 1 1722 | } 1723 | }, 1724 | { 1725 | "severity": "convention", 1726 | "message": "Line is too long. [97/80]", 1727 | "cop_name": "Layout/LineLength", 1728 | "corrected": false, 1729 | "location": { 1730 | "start_line": 2, 1731 | "start_column": 81, 1732 | "last_line": 2, 1733 | "last_column": 97, 1734 | "length": 17, 1735 | "line": 2, 1736 | "column": 81 1737 | } 1738 | }, 1739 | { 1740 | "severity": "convention", 1741 | "message": "Line is too long. [85/80]", 1742 | "cop_name": "Layout/LineLength", 1743 | "corrected": false, 1744 | "location": { 1745 | "start_line": 4, 1746 | "start_column": 81, 1747 | "last_line": 4, 1748 | "last_column": 85, 1749 | "length": 5, 1750 | "line": 4, 1751 | "column": 81 1752 | } 1753 | }, 1754 | { 1755 | "severity": "convention", 1756 | "message": "Line is too long. [87/80]", 1757 | "cop_name": "Layout/LineLength", 1758 | "corrected": false, 1759 | "location": { 1760 | "start_line": 19, 1761 | "start_column": 81, 1762 | "last_line": 19, 1763 | "last_column": 87, 1764 | "length": 7, 1765 | "line": 19, 1766 | "column": 81 1767 | } 1768 | }, 1769 | { 1770 | "severity": "convention", 1771 | "message": "Line is too long. [97/80]", 1772 | "cop_name": "Layout/LineLength", 1773 | "corrected": false, 1774 | "location": { 1775 | "start_line": 20, 1776 | "start_column": 81, 1777 | "last_line": 20, 1778 | "last_column": 97, 1779 | "length": 17, 1780 | "line": 20, 1781 | "column": 81 1782 | } 1783 | }, 1784 | { 1785 | "severity": "convention", 1786 | "message": "Line is too long. [102/80]", 1787 | "cop_name": "Layout/LineLength", 1788 | "corrected": false, 1789 | "location": { 1790 | "start_line": 34, 1791 | "start_column": 81, 1792 | "last_line": 34, 1793 | "last_column": 102, 1794 | "length": 22, 1795 | "line": 34, 1796 | "column": 81 1797 | } 1798 | }, 1799 | { 1800 | "severity": "convention", 1801 | "message": "Line is too long. [86/80]", 1802 | "cop_name": "Layout/LineLength", 1803 | "corrected": false, 1804 | "location": { 1805 | "start_line": 43, 1806 | "start_column": 81, 1807 | "last_line": 43, 1808 | "last_column": 86, 1809 | "length": 6, 1810 | "line": 43, 1811 | "column": 81 1812 | } 1813 | }, 1814 | { 1815 | "severity": "convention", 1816 | "message": "Line is too long. [96/80]", 1817 | "cop_name": "Layout/LineLength", 1818 | "corrected": false, 1819 | "location": { 1820 | "start_line": 49, 1821 | "start_column": 81, 1822 | "last_line": 49, 1823 | "last_column": 96, 1824 | "length": 16, 1825 | "line": 49, 1826 | "column": 81 1827 | } 1828 | }, 1829 | { 1830 | "severity": "convention", 1831 | "message": "Line is too long. [96/80]", 1832 | "cop_name": "Layout/LineLength", 1833 | "corrected": false, 1834 | "location": { 1835 | "start_line": 51, 1836 | "start_column": 81, 1837 | "last_line": 51, 1838 | "last_column": 96, 1839 | "length": 16, 1840 | "line": 51, 1841 | "column": 81 1842 | } 1843 | }, 1844 | { 1845 | "severity": "convention", 1846 | "message": "Do not use space inside array brackets.", 1847 | "cop_name": "Layout/SpaceInsideArrayLiteralBrackets", 1848 | "corrected": false, 1849 | "location": { 1850 | "start_line": 59, 1851 | "start_column": 22, 1852 | "last_line": 59, 1853 | "last_column": 22, 1854 | "length": 1, 1855 | "line": 59, 1856 | "column": 22 1857 | } 1858 | }, 1859 | { 1860 | "severity": "convention", 1861 | "message": "Do not use space inside array brackets.", 1862 | "cop_name": "Layout/SpaceInsideArrayLiteralBrackets", 1863 | "corrected": false, 1864 | "location": { 1865 | "start_line": 59, 1866 | "start_column": 34, 1867 | "last_line": 59, 1868 | "last_column": 34, 1869 | "length": 1, 1870 | "line": 59, 1871 | "column": 34 1872 | } 1873 | }, 1874 | { 1875 | "severity": "convention", 1876 | "message": "Line is too long. [83/80]", 1877 | "cop_name": "Layout/LineLength", 1878 | "corrected": false, 1879 | "location": { 1880 | "start_line": 64, 1881 | "start_column": 81, 1882 | "last_line": 64, 1883 | "last_column": 83, 1884 | "length": 3, 1885 | "line": 64, 1886 | "column": 81 1887 | } 1888 | }, 1889 | { 1890 | "severity": "convention", 1891 | "message": "Line is too long. [100/80]", 1892 | "cop_name": "Layout/LineLength", 1893 | "corrected": false, 1894 | "location": { 1895 | "start_line": 71, 1896 | "start_column": 81, 1897 | "last_line": 71, 1898 | "last_column": 100, 1899 | "length": 20, 1900 | "line": 71, 1901 | "column": 81 1902 | } 1903 | }, 1904 | { 1905 | "severity": "convention", 1906 | "message": "Line is too long. [83/80]", 1907 | "cop_name": "Layout/LineLength", 1908 | "corrected": false, 1909 | "location": { 1910 | "start_line": 86, 1911 | "start_column": 81, 1912 | "last_line": 86, 1913 | "last_column": 83, 1914 | "length": 3, 1915 | "line": 86, 1916 | "column": 81 1917 | } 1918 | }, 1919 | { 1920 | "severity": "convention", 1921 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 1922 | "cop_name": "Style/StringLiterals", 1923 | "corrected": false, 1924 | "location": { 1925 | "start_line": 88, 1926 | "start_column": 10, 1927 | "last_line": 88, 1928 | "last_column": 30, 1929 | "length": 21, 1930 | "line": 88, 1931 | "column": 10 1932 | } 1933 | } 1934 | ] 1935 | }, 1936 | { 1937 | "path": "config/environments/test.rb", 1938 | "offenses": [ 1939 | { 1940 | "severity": "convention", 1941 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1942 | "cop_name": "Style/FrozenStringLiteralComment", 1943 | "corrected": false, 1944 | "location": { 1945 | "start_line": 1, 1946 | "start_column": 1, 1947 | "last_line": 1, 1948 | "last_column": 1, 1949 | "length": 1, 1950 | "line": 1, 1951 | "column": 1 1952 | } 1953 | }, 1954 | { 1955 | "severity": "convention", 1956 | "message": "Line is too long. [85/80]", 1957 | "cop_name": "Layout/LineLength", 1958 | "corrected": false, 1959 | "location": { 1960 | "start_line": 2, 1961 | "start_column": 81, 1962 | "last_line": 2, 1963 | "last_column": 85, 1964 | "length": 5, 1965 | "line": 2, 1966 | "column": 81 1967 | } 1968 | } 1969 | ] 1970 | }, 1971 | { 1972 | "path": "config/initializers/application_controller_renderer.rb", 1973 | "offenses": [ 1974 | { 1975 | "severity": "convention", 1976 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1977 | "cop_name": "Style/FrozenStringLiteralComment", 1978 | "corrected": false, 1979 | "location": { 1980 | "start_line": 1, 1981 | "start_column": 1, 1982 | "last_line": 1, 1983 | "last_column": 1, 1984 | "length": 1, 1985 | "line": 1, 1986 | "column": 1 1987 | } 1988 | } 1989 | ] 1990 | }, 1991 | { 1992 | "path": "config/initializers/assets.rb", 1993 | "offenses": [ 1994 | { 1995 | "severity": "convention", 1996 | "message": "Missing magic comment `# frozen_string_literal: true`.", 1997 | "cop_name": "Style/FrozenStringLiteralComment", 1998 | "corrected": false, 1999 | "location": { 2000 | "start_line": 1, 2001 | "start_column": 1, 2002 | "last_line": 1, 2003 | "last_column": 1, 2004 | "length": 1, 2005 | "line": 1, 2006 | "column": 1 2007 | } 2008 | } 2009 | ] 2010 | }, 2011 | { 2012 | "path": "config/initializers/backtrace_silencers.rb", 2013 | "offenses": [ 2014 | { 2015 | "severity": "convention", 2016 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2017 | "cop_name": "Style/FrozenStringLiteralComment", 2018 | "corrected": false, 2019 | "location": { 2020 | "start_line": 1, 2021 | "start_column": 1, 2022 | "last_line": 1, 2023 | "last_column": 1, 2024 | "length": 1, 2025 | "line": 1, 2026 | "column": 1 2027 | } 2028 | }, 2029 | { 2030 | "severity": "convention", 2031 | "message": "Line is too long. [107/80]", 2032 | "cop_name": "Layout/LineLength", 2033 | "corrected": false, 2034 | "location": { 2035 | "start_line": 3, 2036 | "start_column": 81, 2037 | "last_line": 3, 2038 | "last_column": 107, 2039 | "length": 27, 2040 | "line": 3, 2041 | "column": 81 2042 | } 2043 | }, 2044 | { 2045 | "severity": "convention", 2046 | "message": "Line is too long. [112/80]", 2047 | "cop_name": "Layout/LineLength", 2048 | "corrected": false, 2049 | "location": { 2050 | "start_line": 6, 2051 | "start_column": 81, 2052 | "last_line": 6, 2053 | "last_column": 112, 2054 | "length": 32, 2055 | "line": 6, 2056 | "column": 81 2057 | } 2058 | } 2059 | ] 2060 | }, 2061 | { 2062 | "path": "config/initializers/content_security_policy.rb", 2063 | "offenses": [ 2064 | { 2065 | "severity": "convention", 2066 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2067 | "cop_name": "Style/FrozenStringLiteralComment", 2068 | "corrected": false, 2069 | "location": { 2070 | "start_line": 1, 2071 | "start_column": 1, 2072 | "last_line": 1, 2073 | "last_column": 1, 2074 | "length": 1, 2075 | "line": 1, 2076 | "column": 1 2077 | } 2078 | }, 2079 | { 2080 | "severity": "convention", 2081 | "message": "Line is too long. [107/80]", 2082 | "cop_name": "Layout/LineLength", 2083 | "corrected": false, 2084 | "location": { 2085 | "start_line": 20, 2086 | "start_column": 81, 2087 | "last_line": 20, 2088 | "last_column": 107, 2089 | "length": 27, 2090 | "line": 20, 2091 | "column": 81 2092 | } 2093 | } 2094 | ] 2095 | }, 2096 | { 2097 | "path": "config/initializers/cookies_serializer.rb", 2098 | "offenses": [ 2099 | { 2100 | "severity": "convention", 2101 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2102 | "cop_name": "Style/FrozenStringLiteralComment", 2103 | "corrected": false, 2104 | "location": { 2105 | "start_line": 1, 2106 | "start_column": 1, 2107 | "last_line": 1, 2108 | "last_column": 1, 2109 | "length": 1, 2110 | "line": 1, 2111 | "column": 1 2112 | } 2113 | } 2114 | ] 2115 | }, 2116 | { 2117 | "path": "config/initializers/filter_parameter_logging.rb", 2118 | "offenses": [ 2119 | { 2120 | "severity": "convention", 2121 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2122 | "cop_name": "Style/FrozenStringLiteralComment", 2123 | "corrected": false, 2124 | "location": { 2125 | "start_line": 1, 2126 | "start_column": 1, 2127 | "last_line": 1, 2128 | "last_column": 1, 2129 | "length": 1, 2130 | "line": 1, 2131 | "column": 1 2132 | } 2133 | } 2134 | ] 2135 | }, 2136 | { 2137 | "path": "config/initializers/inflections.rb", 2138 | "offenses": [ 2139 | { 2140 | "severity": "convention", 2141 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2142 | "cop_name": "Style/FrozenStringLiteralComment", 2143 | "corrected": false, 2144 | "location": { 2145 | "start_line": 1, 2146 | "start_column": 1, 2147 | "last_line": 1, 2148 | "last_column": 1, 2149 | "length": 1, 2150 | "line": 1, 2151 | "column": 1 2152 | } 2153 | } 2154 | ] 2155 | }, 2156 | { 2157 | "path": "config/initializers/mime_types.rb", 2158 | "offenses": [ 2159 | { 2160 | "severity": "convention", 2161 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2162 | "cop_name": "Style/FrozenStringLiteralComment", 2163 | "corrected": false, 2164 | "location": { 2165 | "start_line": 1, 2166 | "start_column": 1, 2167 | "last_line": 1, 2168 | "last_column": 1, 2169 | "length": 1, 2170 | "line": 1, 2171 | "column": 1 2172 | } 2173 | } 2174 | ] 2175 | }, 2176 | { 2177 | "path": "config/initializers/wrap_parameters.rb", 2178 | "offenses": [ 2179 | { 2180 | "severity": "convention", 2181 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2182 | "cop_name": "Style/FrozenStringLiteralComment", 2183 | "corrected": false, 2184 | "location": { 2185 | "start_line": 1, 2186 | "start_column": 1, 2187 | "last_line": 1, 2188 | "last_column": 1, 2189 | "length": 1, 2190 | "line": 1, 2191 | "column": 1 2192 | } 2193 | }, 2194 | { 2195 | "severity": "convention", 2196 | "message": "Line is too long. [96/80]", 2197 | "cop_name": "Layout/LineLength", 2198 | "corrected": false, 2199 | "location": { 2200 | "start_line": 6, 2201 | "start_column": 81, 2202 | "last_line": 6, 2203 | "last_column": 96, 2204 | "length": 16, 2205 | "line": 6, 2206 | "column": 81 2207 | } 2208 | } 2209 | ] 2210 | }, 2211 | { 2212 | "path": "config/puma.rb", 2213 | "offenses": [ 2214 | { 2215 | "severity": "convention", 2216 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2217 | "cop_name": "Style/FrozenStringLiteralComment", 2218 | "corrected": false, 2219 | "location": { 2220 | "start_line": 1, 2221 | "start_column": 1, 2222 | "last_line": 1, 2223 | "last_column": 1, 2224 | "length": 1, 2225 | "line": 1, 2226 | "column": 1 2227 | } 2228 | }, 2229 | { 2230 | "severity": "convention", 2231 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2232 | "cop_name": "Style/StringLiterals", 2233 | "corrected": false, 2234 | "location": { 2235 | "start_line": 7, 2236 | "start_column": 27, 2237 | "last_line": 7, 2238 | "last_column": 45, 2239 | "length": 19, 2240 | "line": 7, 2241 | "column": 27 2242 | } 2243 | }, 2244 | { 2245 | "severity": "convention", 2246 | "message": "Line is too long. [85/80]", 2247 | "cop_name": "Layout/LineLength", 2248 | "corrected": false, 2249 | "location": { 2250 | "start_line": 10, 2251 | "start_column": 81, 2252 | "last_line": 10, 2253 | "last_column": 85, 2254 | "length": 5, 2255 | "line": 10, 2256 | "column": 81 2257 | } 2258 | }, 2259 | { 2260 | "severity": "convention", 2261 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2262 | "cop_name": "Style/StringLiterals", 2263 | "corrected": false, 2264 | "location": { 2265 | "start_line": 12, 2266 | "start_column": 23, 2267 | "last_line": 12, 2268 | "last_column": 28, 2269 | "length": 6, 2270 | "line": 12, 2271 | "column": 23 2272 | } 2273 | }, 2274 | { 2275 | "severity": "convention", 2276 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2277 | "cop_name": "Style/StringLiterals", 2278 | "corrected": false, 2279 | "location": { 2280 | "start_line": 16, 2281 | "start_column": 23, 2282 | "last_line": 16, 2283 | "last_column": 33, 2284 | "length": 11, 2285 | "line": 16, 2286 | "column": 23 2287 | } 2288 | }, 2289 | { 2290 | "severity": "convention", 2291 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2292 | "cop_name": "Style/StringLiterals", 2293 | "corrected": false, 2294 | "location": { 2295 | "start_line": 16, 2296 | "start_column": 38, 2297 | "last_line": 16, 2298 | "last_column": 50, 2299 | "length": 13, 2300 | "line": 16, 2301 | "column": 38 2302 | } 2303 | } 2304 | ] 2305 | }, 2306 | { 2307 | "path": "config/routes.rb", 2308 | "offenses": [ 2309 | { 2310 | "severity": "convention", 2311 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2312 | "cop_name": "Style/FrozenStringLiteralComment", 2313 | "corrected": false, 2314 | "location": { 2315 | "start_line": 1, 2316 | "start_column": 1, 2317 | "last_line": 1, 2318 | "last_column": 1, 2319 | "length": 1, 2320 | "line": 1, 2321 | "column": 1 2322 | } 2323 | }, 2324 | { 2325 | "severity": "convention", 2326 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2327 | "cop_name": "Style/StringLiterals", 2328 | "corrected": false, 2329 | "location": { 2330 | "start_line": 5, 2331 | "start_column": 8, 2332 | "last_line": 5, 2333 | "last_column": 20, 2334 | "length": 13, 2335 | "line": 5, 2336 | "column": 8 2337 | } 2338 | } 2339 | ] 2340 | }, 2341 | { 2342 | "path": "config/spring.rb", 2343 | "offenses": [ 2344 | { 2345 | "severity": "convention", 2346 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2347 | "cop_name": "Style/FrozenStringLiteralComment", 2348 | "corrected": false, 2349 | "location": { 2350 | "start_line": 1, 2351 | "start_column": 1, 2352 | "last_line": 1, 2353 | "last_column": 1, 2354 | "length": 1, 2355 | "line": 1, 2356 | "column": 1 2357 | } 2358 | } 2359 | ] 2360 | }, 2361 | { 2362 | "path": "db/migrate/20181227161008_create_posts.rb", 2363 | "offenses": [ 2364 | { 2365 | "severity": "convention", 2366 | "message": "Missing top-level class documentation comment.", 2367 | "cop_name": "Style/Documentation", 2368 | "corrected": false, 2369 | "location": { 2370 | "start_line": 1, 2371 | "start_column": 1, 2372 | "last_line": 1, 2373 | "last_column": 5, 2374 | "length": 5, 2375 | "line": 1, 2376 | "column": 1 2377 | } 2378 | }, 2379 | { 2380 | "severity": "convention", 2381 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2382 | "cop_name": "Style/FrozenStringLiteralComment", 2383 | "corrected": false, 2384 | "location": { 2385 | "start_line": 1, 2386 | "start_column": 1, 2387 | "last_line": 1, 2388 | "last_column": 1, 2389 | "length": 1, 2390 | "line": 1, 2391 | "column": 1 2392 | } 2393 | } 2394 | ] 2395 | }, 2396 | { 2397 | "path": "db/migrate/20181228000432_add_count_words_to_posts.rb", 2398 | "offenses": [ 2399 | { 2400 | "severity": "convention", 2401 | "message": "Missing top-level class documentation comment.", 2402 | "cop_name": "Style/Documentation", 2403 | "corrected": false, 2404 | "location": { 2405 | "start_line": 1, 2406 | "start_column": 1, 2407 | "last_line": 1, 2408 | "last_column": 5, 2409 | "length": 5, 2410 | "line": 1, 2411 | "column": 1 2412 | } 2413 | }, 2414 | { 2415 | "severity": "convention", 2416 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2417 | "cop_name": "Style/FrozenStringLiteralComment", 2418 | "corrected": false, 2419 | "location": { 2420 | "start_line": 1, 2421 | "start_column": 1, 2422 | "last_line": 1, 2423 | "last_column": 1, 2424 | "length": 1, 2425 | "line": 1, 2426 | "column": 1 2427 | } 2428 | } 2429 | ] 2430 | }, 2431 | { 2432 | "path": "db/schema.rb", 2433 | "offenses": [ 2434 | { 2435 | "severity": "convention", 2436 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2437 | "cop_name": "Style/FrozenStringLiteralComment", 2438 | "corrected": false, 2439 | "location": { 2440 | "start_line": 1, 2441 | "start_column": 1, 2442 | "last_line": 1, 2443 | "last_column": 1, 2444 | "length": 1, 2445 | "line": 1, 2446 | "column": 1 2447 | } 2448 | }, 2449 | { 2450 | "severity": "convention", 2451 | "message": "Line is too long. [81/80]", 2452 | "cop_name": "Layout/LineLength", 2453 | "corrected": false, 2454 | "location": { 2455 | "start_line": 3, 2456 | "start_column": 81, 2457 | "last_line": 3, 2458 | "last_column": 81, 2459 | "length": 1, 2460 | "line": 3, 2461 | "column": 81 2462 | } 2463 | }, 2464 | { 2465 | "severity": "convention", 2466 | "message": "Line is too long. [86/80]", 2467 | "cop_name": "Layout/LineLength", 2468 | "corrected": false, 2469 | "location": { 2470 | "start_line": 8, 2471 | "start_column": 81, 2472 | "last_line": 8, 2473 | "last_column": 86, 2474 | "length": 6, 2475 | "line": 8, 2476 | "column": 81 2477 | } 2478 | }, 2479 | { 2480 | "severity": "convention", 2481 | "message": "Line is too long. [86/80]", 2482 | "cop_name": "Layout/LineLength", 2483 | "corrected": false, 2484 | "location": { 2485 | "start_line": 11, 2486 | "start_column": 81, 2487 | "last_line": 11, 2488 | "last_column": 86, 2489 | "length": 6, 2490 | "line": 11, 2491 | "column": 81 2492 | } 2493 | }, 2494 | { 2495 | "severity": "convention", 2496 | "message": "Use underscores(_) as thousands separator and separate every 3 digits with them.", 2497 | "cop_name": "Style/NumericLiterals", 2498 | "corrected": false, 2499 | "location": { 2500 | "start_line": 13, 2501 | "start_column": 38, 2502 | "last_line": 13, 2503 | "last_column": 54, 2504 | "length": 17, 2505 | "line": 13, 2506 | "column": 38 2507 | } 2508 | }, 2509 | { 2510 | "severity": "convention", 2511 | "message": "Extra empty line detected at block body beginning.", 2512 | "cop_name": "Layout/EmptyLinesAroundBlockBody", 2513 | "corrected": false, 2514 | "location": { 2515 | "start_line": 14, 2516 | "start_column": 1, 2517 | "last_line": 15, 2518 | "last_column": 0, 2519 | "length": 1, 2520 | "line": 14, 2521 | "column": 1 2522 | } 2523 | }, 2524 | { 2525 | "severity": "convention", 2526 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2527 | "cop_name": "Style/StringLiterals", 2528 | "corrected": false, 2529 | "location": { 2530 | "start_line": 16, 2531 | "start_column": 20, 2532 | "last_line": 16, 2533 | "last_column": 28, 2534 | "length": 9, 2535 | "line": 16, 2536 | "column": 20 2537 | } 2538 | }, 2539 | { 2540 | "severity": "convention", 2541 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2542 | "cop_name": "Style/StringLiterals", 2543 | "corrected": false, 2544 | "location": { 2545 | "start_line": 18, 2546 | "start_column": 16, 2547 | "last_line": 18, 2548 | "last_column": 22, 2549 | "length": 7, 2550 | "line": 18, 2551 | "column": 16 2552 | } 2553 | }, 2554 | { 2555 | "severity": "convention", 2556 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2557 | "cop_name": "Style/StringLiterals", 2558 | "corrected": false, 2559 | "location": { 2560 | "start_line": 19, 2561 | "start_column": 14, 2562 | "last_line": 19, 2563 | "last_column": 20, 2564 | "length": 7, 2565 | "line": 19, 2566 | "column": 14 2567 | } 2568 | }, 2569 | { 2570 | "severity": "convention", 2571 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2572 | "cop_name": "Style/StringLiterals", 2573 | "corrected": false, 2574 | "location": { 2575 | "start_line": 20, 2576 | "start_column": 14, 2577 | "last_line": 20, 2578 | "last_column": 19, 2579 | "length": 6, 2580 | "line": 20, 2581 | "column": 14 2582 | } 2583 | }, 2584 | { 2585 | "severity": "convention", 2586 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2587 | "cop_name": "Style/StringLiterals", 2588 | "corrected": false, 2589 | "location": { 2590 | "start_line": 21, 2591 | "start_column": 16, 2592 | "last_line": 21, 2593 | "last_column": 27, 2594 | "length": 12, 2595 | "line": 21, 2596 | "column": 16 2597 | } 2598 | }, 2599 | { 2600 | "severity": "convention", 2601 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2602 | "cop_name": "Style/StringLiterals", 2603 | "corrected": false, 2604 | "location": { 2605 | "start_line": 22, 2606 | "start_column": 16, 2607 | "last_line": 22, 2608 | "last_column": 27, 2609 | "length": 12, 2610 | "line": 22, 2611 | "column": 16 2612 | } 2613 | }, 2614 | { 2615 | "severity": "convention", 2616 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2617 | "cop_name": "Style/StringLiterals", 2618 | "corrected": false, 2619 | "location": { 2620 | "start_line": 23, 2621 | "start_column": 15, 2622 | "last_line": 23, 2623 | "last_column": 27, 2624 | "length": 13, 2625 | "line": 23, 2626 | "column": 15 2627 | } 2628 | }, 2629 | { 2630 | "severity": "convention", 2631 | "message": "Extra empty line detected at block body end.", 2632 | "cop_name": "Layout/EmptyLinesAroundBlockBody", 2633 | "corrected": false, 2634 | "location": { 2635 | "start_line": 25, 2636 | "start_column": 1, 2637 | "last_line": 26, 2638 | "last_column": 0, 2639 | "length": 1, 2640 | "line": 25, 2641 | "column": 1 2642 | } 2643 | } 2644 | ] 2645 | }, 2646 | { 2647 | "path": "db/seeds.rb", 2648 | "offenses": [ 2649 | { 2650 | "severity": "convention", 2651 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2652 | "cop_name": "Style/FrozenStringLiteralComment", 2653 | "corrected": false, 2654 | "location": { 2655 | "start_line": 1, 2656 | "start_column": 1, 2657 | "last_line": 1, 2658 | "last_column": 1, 2659 | "length": 1, 2660 | "line": 1, 2661 | "column": 1 2662 | } 2663 | }, 2664 | { 2665 | "severity": "convention", 2666 | "message": "Line is too long. [103/80]", 2667 | "cop_name": "Layout/LineLength", 2668 | "corrected": false, 2669 | "location": { 2670 | "start_line": 1, 2671 | "start_column": 81, 2672 | "last_line": 1, 2673 | "last_column": 103, 2674 | "length": 23, 2675 | "line": 1, 2676 | "column": 81 2677 | } 2678 | }, 2679 | { 2680 | "severity": "convention", 2681 | "message": "Line is too long. [111/80]", 2682 | "cop_name": "Layout/LineLength", 2683 | "corrected": false, 2684 | "location": { 2685 | "start_line": 2, 2686 | "start_column": 81, 2687 | "last_line": 2, 2688 | "last_column": 111, 2689 | "length": 31, 2690 | "line": 2, 2691 | "column": 81 2692 | } 2693 | }, 2694 | { 2695 | "severity": "convention", 2696 | "message": "Line is too long. [81/80]", 2697 | "cop_name": "Layout/LineLength", 2698 | "corrected": false, 2699 | "location": { 2700 | "start_line": 6, 2701 | "start_column": 81, 2702 | "last_line": 6, 2703 | "last_column": 81, 2704 | "length": 1, 2705 | "line": 6, 2706 | "column": 81 2707 | } 2708 | } 2709 | ] 2710 | }, 2711 | { 2712 | "path": "test/application_system_test_case.rb", 2713 | "offenses": [ 2714 | { 2715 | "severity": "convention", 2716 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2717 | "cop_name": "Style/FrozenStringLiteralComment", 2718 | "corrected": false, 2719 | "location": { 2720 | "start_line": 1, 2721 | "start_column": 1, 2722 | "last_line": 1, 2723 | "last_column": 1, 2724 | "length": 1, 2725 | "line": 1, 2726 | "column": 1 2727 | } 2728 | }, 2729 | { 2730 | "severity": "convention", 2731 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2732 | "cop_name": "Style/StringLiterals", 2733 | "corrected": false, 2734 | "location": { 2735 | "start_line": 1, 2736 | "start_column": 9, 2737 | "last_line": 1, 2738 | "last_column": 21, 2739 | "length": 13, 2740 | "line": 1, 2741 | "column": 9 2742 | } 2743 | } 2744 | ] 2745 | }, 2746 | { 2747 | "path": "test/controllers/posts_controller_test.rb", 2748 | "offenses": [ 2749 | { 2750 | "severity": "convention", 2751 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2752 | "cop_name": "Style/FrozenStringLiteralComment", 2753 | "corrected": false, 2754 | "location": { 2755 | "start_line": 1, 2756 | "start_column": 1, 2757 | "last_line": 1, 2758 | "last_column": 1, 2759 | "length": 1, 2760 | "line": 1, 2761 | "column": 1 2762 | } 2763 | }, 2764 | { 2765 | "severity": "convention", 2766 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2767 | "cop_name": "Style/StringLiterals", 2768 | "corrected": false, 2769 | "location": { 2770 | "start_line": 8, 2771 | "start_column": 8, 2772 | "last_line": 8, 2773 | "last_column": 25, 2774 | "length": 18, 2775 | "line": 8, 2776 | "column": 8 2777 | } 2778 | }, 2779 | { 2780 | "severity": "convention", 2781 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2782 | "cop_name": "Style/StringLiterals", 2783 | "corrected": false, 2784 | "location": { 2785 | "start_line": 13, 2786 | "start_column": 8, 2787 | "last_line": 13, 2788 | "last_column": 23, 2789 | "length": 16, 2790 | "line": 13, 2791 | "column": 8 2792 | } 2793 | }, 2794 | { 2795 | "severity": "convention", 2796 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2797 | "cop_name": "Style/StringLiterals", 2798 | "corrected": false, 2799 | "location": { 2800 | "start_line": 18, 2801 | "start_column": 8, 2802 | "last_line": 18, 2803 | "last_column": 27, 2804 | "length": 20, 2805 | "line": 18, 2806 | "column": 8 2807 | } 2808 | }, 2809 | { 2810 | "severity": "convention", 2811 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2812 | "cop_name": "Style/StringLiterals", 2813 | "corrected": false, 2814 | "location": { 2815 | "start_line": 26, 2816 | "start_column": 8, 2817 | "last_line": 26, 2818 | "last_column": 25, 2819 | "length": 18, 2820 | "line": 26, 2821 | "column": 8 2822 | } 2823 | }, 2824 | { 2825 | "severity": "convention", 2826 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2827 | "cop_name": "Style/StringLiterals", 2828 | "corrected": false, 2829 | "location": { 2830 | "start_line": 31, 2831 | "start_column": 8, 2832 | "last_line": 31, 2833 | "last_column": 24, 2834 | "length": 17, 2835 | "line": 31, 2836 | "column": 8 2837 | } 2838 | }, 2839 | { 2840 | "severity": "convention", 2841 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2842 | "cop_name": "Style/StringLiterals", 2843 | "corrected": false, 2844 | "location": { 2845 | "start_line": 36, 2846 | "start_column": 8, 2847 | "last_line": 36, 2848 | "last_column": 27, 2849 | "length": 20, 2850 | "line": 36, 2851 | "column": 8 2852 | } 2853 | }, 2854 | { 2855 | "severity": "convention", 2856 | "message": "Line is too long. [85/80]", 2857 | "cop_name": "Layout/LineLength", 2858 | "corrected": false, 2859 | "location": { 2860 | "start_line": 37, 2861 | "start_column": 81, 2862 | "last_line": 37, 2863 | "last_column": 85, 2864 | "length": 5, 2865 | "line": 37, 2866 | "column": 81 2867 | } 2868 | }, 2869 | { 2870 | "severity": "convention", 2871 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2872 | "cop_name": "Style/StringLiterals", 2873 | "corrected": false, 2874 | "location": { 2875 | "start_line": 41, 2876 | "start_column": 8, 2877 | "last_line": 41, 2878 | "last_column": 28, 2879 | "length": 21, 2880 | "line": 41, 2881 | "column": 8 2882 | } 2883 | } 2884 | ] 2885 | }, 2886 | { 2887 | "path": "test/jobs/post_count_word_job_test.rb", 2888 | "offenses": [ 2889 | { 2890 | "severity": "convention", 2891 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2892 | "cop_name": "Style/FrozenStringLiteralComment", 2893 | "corrected": false, 2894 | "location": { 2895 | "start_line": 1, 2896 | "start_column": 1, 2897 | "last_line": 1, 2898 | "last_column": 1, 2899 | "length": 1, 2900 | "line": 1, 2901 | "column": 1 2902 | } 2903 | } 2904 | ] 2905 | }, 2906 | { 2907 | "path": "test/models/post_test.rb", 2908 | "offenses": [ 2909 | { 2910 | "severity": "convention", 2911 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2912 | "cop_name": "Style/FrozenStringLiteralComment", 2913 | "corrected": false, 2914 | "location": { 2915 | "start_line": 1, 2916 | "start_column": 1, 2917 | "last_line": 1, 2918 | "last_column": 1, 2919 | "length": 1, 2920 | "line": 1, 2921 | "column": 1 2922 | } 2923 | } 2924 | ] 2925 | }, 2926 | { 2927 | "path": "test/system/posts_test.rb", 2928 | "offenses": [ 2929 | { 2930 | "severity": "convention", 2931 | "message": "Missing magic comment `# frozen_string_literal: true`.", 2932 | "cop_name": "Style/FrozenStringLiteralComment", 2933 | "corrected": false, 2934 | "location": { 2935 | "start_line": 1, 2936 | "start_column": 1, 2937 | "last_line": 1, 2938 | "last_column": 1, 2939 | "length": 1, 2940 | "line": 1, 2941 | "column": 1 2942 | } 2943 | }, 2944 | { 2945 | "severity": "convention", 2946 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2947 | "cop_name": "Style/StringLiterals", 2948 | "corrected": false, 2949 | "location": { 2950 | "start_line": 1, 2951 | "start_column": 9, 2952 | "last_line": 1, 2953 | "last_column": 38, 2954 | "length": 30, 2955 | "line": 1, 2956 | "column": 9 2957 | } 2958 | }, 2959 | { 2960 | "severity": "convention", 2961 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2962 | "cop_name": "Style/StringLiterals", 2963 | "corrected": false, 2964 | "location": { 2965 | "start_line": 8, 2966 | "start_column": 8, 2967 | "last_line": 8, 2968 | "last_column": 27, 2969 | "length": 20, 2970 | "line": 8, 2971 | "column": 8 2972 | } 2973 | }, 2974 | { 2975 | "severity": "convention", 2976 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2977 | "cop_name": "Style/StringLiterals", 2978 | "corrected": false, 2979 | "location": { 2980 | "start_line": 10, 2981 | "start_column": 21, 2982 | "last_line": 10, 2983 | "last_column": 24, 2984 | "length": 4, 2985 | "line": 10, 2986 | "column": 21 2987 | } 2988 | }, 2989 | { 2990 | "severity": "convention", 2991 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 2992 | "cop_name": "Style/StringLiterals", 2993 | "corrected": false, 2994 | "location": { 2995 | "start_line": 10, 2996 | "start_column": 33, 2997 | "last_line": 10, 2998 | "last_column": 39, 2999 | "length": 7, 3000 | "line": 10, 3001 | "column": 33 3002 | } 3003 | }, 3004 | { 3005 | "severity": "convention", 3006 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3007 | "cop_name": "Style/StringLiterals", 3008 | "corrected": false, 3009 | "location": { 3010 | "start_line": 13, 3011 | "start_column": 8, 3012 | "last_line": 13, 3013 | "last_column": 24, 3014 | "length": 17, 3015 | "line": 13, 3016 | "column": 8 3017 | } 3018 | }, 3019 | { 3020 | "severity": "convention", 3021 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3022 | "cop_name": "Style/StringLiterals", 3023 | "corrected": false, 3024 | "location": { 3025 | "start_line": 15, 3026 | "start_column": 14, 3027 | "last_line": 15, 3028 | "last_column": 23, 3029 | "length": 10, 3030 | "line": 15, 3031 | "column": 14 3032 | } 3033 | }, 3034 | { 3035 | "severity": "convention", 3036 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3037 | "cop_name": "Style/StringLiterals", 3038 | "corrected": false, 3039 | "location": { 3040 | "start_line": 17, 3041 | "start_column": 13, 3042 | "last_line": 17, 3043 | "last_column": 18, 3044 | "length": 6, 3045 | "line": 17, 3046 | "column": 13 3047 | } 3048 | }, 3049 | { 3050 | "severity": "convention", 3051 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3052 | "cop_name": "Style/StringLiterals", 3053 | "corrected": false, 3054 | "location": { 3055 | "start_line": 18, 3056 | "start_column": 13, 3057 | "last_line": 18, 3058 | "last_column": 19, 3059 | "length": 7, 3060 | "line": 18, 3061 | "column": 13 3062 | } 3063 | }, 3064 | { 3065 | "severity": "convention", 3066 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3067 | "cop_name": "Style/StringLiterals", 3068 | "corrected": false, 3069 | "location": { 3070 | "start_line": 19, 3071 | "start_column": 14, 3072 | "last_line": 19, 3073 | "last_column": 26, 3074 | "length": 13, 3075 | "line": 19, 3076 | "column": 14 3077 | } 3078 | }, 3079 | { 3080 | "severity": "convention", 3081 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3082 | "cop_name": "Style/StringLiterals", 3083 | "corrected": false, 3084 | "location": { 3085 | "start_line": 21, 3086 | "start_column": 17, 3087 | "last_line": 21, 3088 | "last_column": 47, 3089 | "length": 31, 3090 | "line": 21, 3091 | "column": 17 3092 | } 3093 | }, 3094 | { 3095 | "severity": "convention", 3096 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3097 | "cop_name": "Style/StringLiterals", 3098 | "corrected": false, 3099 | "location": { 3100 | "start_line": 22, 3101 | "start_column": 14, 3102 | "last_line": 22, 3103 | "last_column": 19, 3104 | "length": 6, 3105 | "line": 22, 3106 | "column": 14 3107 | } 3108 | }, 3109 | { 3110 | "severity": "convention", 3111 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3112 | "cop_name": "Style/StringLiterals", 3113 | "corrected": false, 3114 | "location": { 3115 | "start_line": 25, 3116 | "start_column": 8, 3117 | "last_line": 25, 3118 | "last_column": 24, 3119 | "length": 17, 3120 | "line": 25, 3121 | "column": 8 3122 | } 3123 | }, 3124 | { 3125 | "severity": "convention", 3126 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3127 | "cop_name": "Style/StringLiterals", 3128 | "corrected": false, 3129 | "location": { 3130 | "start_line": 27, 3131 | "start_column": 14, 3132 | "last_line": 27, 3133 | "last_column": 19, 3134 | "length": 6, 3135 | "line": 27, 3136 | "column": 14 3137 | } 3138 | }, 3139 | { 3140 | "severity": "convention", 3141 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3142 | "cop_name": "Style/StringLiterals", 3143 | "corrected": false, 3144 | "location": { 3145 | "start_line": 29, 3146 | "start_column": 13, 3147 | "last_line": 29, 3148 | "last_column": 18, 3149 | "length": 6, 3150 | "line": 29, 3151 | "column": 13 3152 | } 3153 | }, 3154 | { 3155 | "severity": "convention", 3156 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3157 | "cop_name": "Style/StringLiterals", 3158 | "corrected": false, 3159 | "location": { 3160 | "start_line": 30, 3161 | "start_column": 13, 3162 | "last_line": 30, 3163 | "last_column": 19, 3164 | "length": 7, 3165 | "line": 30, 3166 | "column": 13 3167 | } 3168 | }, 3169 | { 3170 | "severity": "convention", 3171 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3172 | "cop_name": "Style/StringLiterals", 3173 | "corrected": false, 3174 | "location": { 3175 | "start_line": 31, 3176 | "start_column": 14, 3177 | "last_line": 31, 3178 | "last_column": 26, 3179 | "length": 13, 3180 | "line": 31, 3181 | "column": 14 3182 | } 3183 | }, 3184 | { 3185 | "severity": "convention", 3186 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3187 | "cop_name": "Style/StringLiterals", 3188 | "corrected": false, 3189 | "location": { 3190 | "start_line": 33, 3191 | "start_column": 17, 3192 | "last_line": 33, 3193 | "last_column": 47, 3194 | "length": 31, 3195 | "line": 33, 3196 | "column": 17 3197 | } 3198 | }, 3199 | { 3200 | "severity": "convention", 3201 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3202 | "cop_name": "Style/StringLiterals", 3203 | "corrected": false, 3204 | "location": { 3205 | "start_line": 34, 3206 | "start_column": 14, 3207 | "last_line": 34, 3208 | "last_column": 19, 3209 | "length": 6, 3210 | "line": 34, 3211 | "column": 14 3212 | } 3213 | }, 3214 | { 3215 | "severity": "convention", 3216 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3217 | "cop_name": "Style/StringLiterals", 3218 | "corrected": false, 3219 | "location": { 3220 | "start_line": 37, 3221 | "start_column": 8, 3222 | "last_line": 37, 3223 | "last_column": 26, 3224 | "length": 19, 3225 | "line": 37, 3226 | "column": 8 3227 | } 3228 | }, 3229 | { 3230 | "severity": "convention", 3231 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3232 | "cop_name": "Style/StringLiterals", 3233 | "corrected": false, 3234 | "location": { 3235 | "start_line": 40, 3236 | "start_column": 16, 3237 | "last_line": 40, 3238 | "last_column": 24, 3239 | "length": 9, 3240 | "line": 40, 3241 | "column": 16 3242 | } 3243 | }, 3244 | { 3245 | "severity": "convention", 3246 | "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", 3247 | "cop_name": "Style/StringLiterals", 3248 | "corrected": false, 3249 | "location": { 3250 | "start_line": 43, 3251 | "start_column": 17, 3252 | "last_line": 43, 3253 | "last_column": 49, 3254 | "length": 33, 3255 | "line": 43, 3256 | "column": 17 3257 | } 3258 | } 3259 | ] 3260 | }, 3261 | { 3262 | "path": "test/test_helper.rb", 3263 | "offenses": [ 3264 | { 3265 | "severity": "convention", 3266 | "message": "Missing magic comment `# frozen_string_literal: true`.", 3267 | "cop_name": "Style/FrozenStringLiteralComment", 3268 | "corrected": false, 3269 | "location": { 3270 | "start_line": 1, 3271 | "start_column": 1, 3272 | "last_line": 1, 3273 | "last_column": 1, 3274 | "length": 1, 3275 | "line": 1, 3276 | "column": 1 3277 | } 3278 | }, 3279 | { 3280 | "severity": "convention", 3281 | "message": "Use nested module/class definitions instead of compact style.", 3282 | "cop_name": "Style/ClassAndModuleChildren", 3283 | "corrected": false, 3284 | "location": { 3285 | "start_line": 5, 3286 | "start_column": 7, 3287 | "last_line": 5, 3288 | "last_column": 29, 3289 | "length": 23, 3290 | "line": 5, 3291 | "column": 7 3292 | } 3293 | }, 3294 | { 3295 | "severity": "convention", 3296 | "message": "Line is too long. [82/80]", 3297 | "cop_name": "Layout/LineLength", 3298 | "corrected": false, 3299 | "location": { 3300 | "start_line": 6, 3301 | "start_column": 81, 3302 | "last_line": 6, 3303 | "last_column": 82, 3304 | "length": 2, 3305 | "line": 6, 3306 | "column": 81 3307 | } 3308 | } 3309 | ] 3310 | } 3311 | ], 3312 | "summary": { 3313 | "offense_count": 201, 3314 | "target_file_count": 54, 3315 | "inspected_file_count": 54 3316 | } 3317 | } 3318 | -------------------------------------------------------------------------------- /spec/github_check_run_service_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "./spec/spec_helper" 4 | 5 | describe Github::CheckRunService do 6 | let(:rubocop_report) { double(build: JSON(File.read("./spec/fixtures/report.json"))) } 7 | let(:github_data) { Github::Data.new(event) } 8 | subject do 9 | Github::CheckRunService.new( 10 | report: rubocop_report, 11 | github_data: github_data, 12 | report_adapter: ReportAdapter, 13 | check_name: "Test" 14 | ) 15 | end 16 | 17 | it "#run" do 18 | stub_request(:any, "https://api.github.com/repos/owner/repository_name/check-runs/id") 19 | .to_return(status: 200, body: '{"__exit_code":0}') 20 | 21 | stub_request(:any, "https://api.github.com/repos/owner/repository_name/check-runs") 22 | .to_return(status: 200, body: '{"id": "id", "__exit_code":1}') 23 | 24 | expect(subject.run).to be_falsey 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/github_data_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "./spec/spec_helper" 4 | 5 | describe Github::Data do 6 | subject { Github::Data.new(event) } 7 | 8 | it "#sha" do 9 | expect(subject.sha).to eq("sha") 10 | end 11 | 12 | it "#token" do 13 | expect(subject.token).to eq("token") 14 | end 15 | 16 | context "environment variables exist" do 17 | it "#owner" do 18 | expect(subject.owner).to eq("owner") 19 | end 20 | 21 | it "#repo" do 22 | expect(subject.repo).to eq("repository_name") 23 | end 24 | end 25 | 26 | it "#workspace" do 27 | expect(subject.workspace).to eq("workspace") 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/helpers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Helpers 4 | def event 5 | {'repository': { 6 | 'owner': { 7 | 'login': "event_login" 8 | }, 9 | 'name': "event_name" 10 | }} 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/install_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "./spec/spec_helper" 4 | 5 | describe Install do 6 | subject { described_class.new(config) } 7 | 8 | let(:config) { YAML.safe_load(config_file) } 9 | 10 | before { allow(subject).to receive(:system) } 11 | 12 | describe "#run" do 13 | before { subject.run } 14 | 15 | context "when there's no configuration" do 16 | let(:config_file) { "" } 17 | 18 | it { expect(subject).to have_received(:system).with("gem install rubocop") } 19 | end 20 | 21 | context "when it's set to resolve dependencies through bundler" do 22 | let(:config_file) do 23 | <<~YAML 24 | bundle: true 25 | YAML 26 | end 27 | 28 | it { expect(subject).to have_received(:system).with("bundle install") } 29 | end 30 | 31 | context "when there's no version specified" do 32 | let(:config_file) do 33 | <<~YAML 34 | versions: 35 | - rubocop 36 | YAML 37 | end 38 | 39 | it { expect(subject).to have_received(:system).with("gem install rubocop") } 40 | end 41 | 42 | context "when the versions are specified" do 43 | let(:config_file) do 44 | <<~YAML 45 | versions: 46 | - rubocop: 0.79.0 47 | - rubocop-rails 48 | - rubocop-rspec: latest 49 | YAML 50 | end 51 | 52 | it { expect(subject).to have_received(:system).with("gem install rubocop:0.79.0 rubocop-rails rubocop-rspec") } 53 | 54 | context "when 'rubocop' is not included in the dependencies" do 55 | let(:config_file) do 56 | <<~YAML 57 | versions: 58 | - rubocop-rails 59 | - rubocop-rspec: 1.37.0 60 | YAML 61 | end 62 | 63 | it { expect(subject).to have_received(:system).with("gem install rubocop rubocop-rails rubocop-rspec:1.37.0") } 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /spec/report_adapter_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "./spec/spec_helper" 4 | 5 | describe ReportAdapter do 6 | subject { described_class } 7 | 8 | let(:rubocop_report) { JSON(File.read("./spec/fixtures/report.json")) } 9 | 10 | context "when exit code is 0" do 11 | it "succeedes" do 12 | rubocop_report["__exit_code"] = 0 13 | expect(subject.conclusion(rubocop_report)).to eq("success") 14 | end 15 | end 16 | 17 | context "when exit code is 1" do 18 | it { expect(subject.conclusion(rubocop_report)).to eq("failure") } 19 | end 20 | 21 | context "summary has offenses" do 22 | it { expect(subject.summary(rubocop_report)).to eq("201 offense(s) found.") } 23 | end 24 | 25 | context "when error is on the same line" do 26 | it "has start and end column keys" do 27 | result = subject.annotations(rubocop_report) 28 | expect(result.first).to eq( 29 | "path" => "Gemfile", 30 | "start_line" => 1, 31 | "end_line" => 1, 32 | "start_column" => 1, 33 | "end_column" => 1, 34 | "annotation_level" => "notice", 35 | "message" => "Missing magic comment `# frozen_string_literal: true`. [Style/FrozenStringLiteralComment]" 36 | ) 37 | end 38 | 39 | context "when the start_column is larger than the end_column" do 40 | it "sets the end_column to the same value as start_column" do 41 | result = subject.annotations(rubocop_report) 42 | expect(result[1]).to eq( 43 | "path" => "Gemfile", 44 | "start_line" => 15, 45 | "end_line" => 15, 46 | "start_column" => 3, 47 | "end_column" => 4, 48 | "annotation_level" => "notice", 49 | "message" => "Final newline missing. [Layout/TrailingBlankLines]" 50 | ) 51 | end 52 | end 53 | end 54 | 55 | context "when error is not on the same line" do 56 | it "does not have start and end column keys" do 57 | result = subject.annotations(rubocop_report) 58 | expect(result[2]).to eq( 59 | "path" => "Gemfile", 60 | "start_line" => 50, 61 | "end_line" => 65, 62 | "annotation_level" => "notice", 63 | "message" => "Method has too many lines. [15/10] [Metrics/MethodLength]" 64 | ) 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # requires ................................................................... 4 | require "webmock/rspec" 5 | require "json" 6 | require "pry" 7 | require "time" 8 | require "yaml" 9 | require "simplecov" 10 | require "codecov" 11 | 12 | # tools ...................................................................... 13 | unless ENV["CODECOV_TOKEN"].to_s.empty? 14 | SimpleCov.start 15 | SimpleCov.formatter = SimpleCov::Formatter::Codecov 16 | end 17 | 18 | # require relatives .......................................................... 19 | require_relative "./../lib/command" 20 | require_relative "./../lib/github/check_run_service" 21 | require_relative "./../lib/github/client" 22 | require_relative "./../lib/github/data" 23 | require_relative "./../lib/install" 24 | require_relative "./../lib/report_adapter" 25 | require_relative "./../lib/util" 26 | require_relative "./../lib/results" 27 | require_relative "./helpers" 28 | 29 | # environment variables ...................................................... 30 | ENV["GITHUB_SHA"] = "sha" 31 | ENV["GITHUB_TOKEN"] = "token" 32 | ENV["GITHUB_REPOSITORY_OWNER"] = "owner" 33 | ENV["GITHUB_REPOSITORY_NAME"] = "repository_name" 34 | ENV["GITHUB_WORKSPACE"] = "workspace" 35 | 36 | # configuration .............................................................. 37 | RSpec.configure do |c| 38 | c.include Helpers 39 | end 40 | -------------------------------------------------------------------------------- /spec/util_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "./spec/spec_helper" 4 | 5 | describe Util do 6 | subject { Util } 7 | 8 | context "path doesn't exist" do 9 | it "#read_json" do 10 | expect(subject.read_json("fake/test/file.json")).to eq({}) 11 | expect { 12 | subject.read_json("fake/test/file.json") 13 | }.to output("\"Notice: No file: fake/test/file.json\"\n").to_stdout 14 | end 15 | 16 | it "#read_yaml" do 17 | expect(subject.read_yaml("fake/test/file.yml")).to eq({}) 18 | expect { 19 | subject.read_yaml("fake/test/file.yml") 20 | }.to output("\"Notice: No file: fake/test/file.yml\"\n").to_stdout 21 | end 22 | end 23 | 24 | context "path does exist" do 25 | it "#read_json" do 26 | expect(subject.read_json("./spec/fixtures/example.json")).to eq("example" => "json") 27 | end 28 | 29 | it "#read_yaml" do 30 | expect(subject.read_yaml("./spec/fixtures/example.yml")).to eq("example" => "yaml") 31 | end 32 | end 33 | end 34 | --------------------------------------------------------------------------------