diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eebffd3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +spec +Gemfile +Gemfile.lock +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile index 0938b76..bcab1f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,15 @@ FROM ruby:2.6.5-alpine -RUN apk add --update build-base git - -LABEL "com.github.actions.name"="Rubocop Linter" -LABEL "com.github.actions.description"="A GitHub Action that lints your Ruby code with Rubocop!" +LABEL "com.github.actions.name"="Brakeman linter" +LABEL "com.github.actions.description"="A GitHub Action that lints your Ruby code with Brakeman!" LABEL "com.github.actions.icon"="code" LABEL "com.github.actions.color"="red" - -LABEL "repository"="https://github.com/andrewmcodes/rubocop-linter-action" -LABEL "maintainer"="Andrew Mason " +LABEL "repository"="https://github.com/devmasx/brakeman-linter-action" +LABEL "maintainer"="Miguel Savignano " LABEL "version"="1.0.0" +RUN gem install brakeman COPY lib /action/lib -RUN gem install bundler -ENTRYPOINT ["/action/lib/entrypoint.sh"] +CMD ["ruby", "/action/lib/index.rb"] diff --git a/lib/action.json b/lib/action.json index ed92626..cce7323 100644 --- a/lib/action.json +++ b/lib/action.json @@ -1,8 +1,8 @@ { "repository": { "owner": { - "login": "andrewmcodes" - } - ,"name": "rubocop-linter" + "login": "devmasx" + }, + "name": "brakeman-linter" } } diff --git a/lib/entrypoint.sh b/lib/entrypoint.sh deleted file mode 100755 index 8a107ff..0000000 --- a/lib/entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -e - -gem install rubocop rubocop-performance rubocop-rails rubocop-minitest rubocop-rspec - -ruby /action/lib/index.rb diff --git a/lib/github_check_run_service.rb b/lib/github_check_run_service.rb index c2e1cd5..c495d55 100644 --- a/lib/github_check_run_service.rb +++ b/lib/github_check_run_service.rb @@ -7,7 +7,7 @@ class GithubCheckRunService @report = report @github_data = github_data @report_adapter = report_adapter - @client = GithubClient.new(@github_data[:token], user_agent: 'rubocop-action') + @client = GithubClient.new(@github_data[:token], user_agent: 'brakeman-action') end def run diff --git a/lib/index.rb b/lib/index.rb index f713167..4638fc3 100644 --- a/lib/index.rb +++ b/lib/index.rb @@ -23,7 +23,7 @@ end if ENV['REPORT_PATH'] read_json(ENV['REPORT_PATH']) else - Dir.chdir(ENV['GITHUB_WORKSPACE']) { JSON.parse(`rubocop -f json`) } + Dir.chdir(ENV['GITHUB_WORKSPACE']) { JSON.parse(`brakeman -f json`) } end GithubCheckRunService.new(@report, @github_data, ReportAdapter).run diff --git a/lib/report_adapter.rb b/lib/report_adapter.rb index a1ba99a..16503f6 100644 --- a/lib/report_adapter.rb +++ b/lib/report_adapter.rb @@ -1,54 +1,38 @@ # frozen_string_literal: true +# https://developer.github.com/v3/checks/runs/#output-object class ReportAdapter class << self CONCLUSION_TYPES = { failure: 'failure', success: 'success' }.freeze - ANNOTATION_LEVELS = { - 'refactor' => 'failure', - 'convention' => 'failure', - 'warning' => 'warning', - 'error' => 'failure', - 'fatal' => 'failure' - }.freeze + ANNOTATION_LEVEL = { notice: 'notice', warning: 'warning', failure: 'failure' }.freeze def conslusion(report) - return CONCLUSION_TYPES[:failure] if total_offenses(report).positive? + return CONCLUSION_TYPES[:failure] if security_warnings(report).positive? CONCLUSION_TYPES[:success] end def summary(report) - "#{total_offenses(report)} offense(s) found" + "**Brakeman Report**: \n - #{security_warnings(report)} security warnings" end def annotations(report) - annotation_list = [] - count = 0 - report['files'].each do |file| - file['offenses'].each do |offense| - count += 1 - return annotation_list if count == 48 - - location = offense['location'] - annotation_list.push( - 'path' => file['path'], - 'start_line' => location['start_line'], - 'end_line' => location['last_line'], - 'annotation_level' => annotation_level(offense['severity']), - 'message' => offense['message'] - ) - end + report['warnings'].map do |error| + { + 'path' => error['file'], + 'start_line' => error['line'], + 'end_line' => error['line'], + 'annotation_level' => ANNOTATION_LEVEL[:warning], + 'title' => "#{error['confidence']} - #{error['check_name']}", + 'message' => error['message'] + } end end private - def annotation_level(severity) - ANNOTATION_LEVELS[severity] - end - - def total_offenses(report) - report.dig('summary', 'offense_count') + def security_warnings(report) + report['scan_info']['security_warnings'] end end end diff --git a/spec/fixtures/event.json b/spec/fixtures/event.json new file mode 100644 index 0000000..03fae54 --- /dev/null +++ b/spec/fixtures/event.json @@ -0,0 +1,171 @@ +{ + "after": "6668752dba6d4f1b1e72e88f7355889cc039176c", + "base_ref": null, + "before": "64bf02a0916fab1a4f5e91a7cd44068302cd31f7", + "commits": [ + { + "author": { + "email": "migue.masx@gmail.com", + "name": "Miguel Savignano", + "username": "MiguelSavignano" + }, + "committer": { + "email": "migue.masx@gmail.com", + "name": "Miguel Savignano", + "username": "MiguelSavignano" + }, + "distinct": true, + "id": "6668752dba6d4f1b1e72e88f7355889cc039176c", + "message": ".", + "timestamp": "2019-10-24T01:13:19+02:00", + "tree_id": "b99d954a0de55070aec5999d530dd7438210f594", + "url": "https://github.com/MiguelSavignano/dockerize-rails/commit/6668752dba6d4f1b1e72e88f7355889cc039176c" + } + ], + "compare": "https://github.com/MiguelSavignano/dockerize-rails/compare/64bf02a0916f...6668752dba6d", + "created": false, + "deleted": false, + "forced": false, + "head_commit": { + "author": { + "email": "migue.masx@gmail.com", + "name": "Miguel Savignano", + "username": "MiguelSavignano" + }, + "committer": { + "email": "migue.masx@gmail.com", + "name": "Miguel Savignano", + "username": "MiguelSavignano" + }, + "distinct": true, + "id": "6668752dba6d4f1b1e72e88f7355889cc039176c", + "message": ".", + "timestamp": "2019-10-24T01:13:19+02:00", + "tree_id": "b99d954a0de55070aec5999d530dd7438210f594", + "url": "https://github.com/MiguelSavignano/dockerize-rails/commit/6668752dba6d4f1b1e72e88f7355889cc039176c" + }, + "pusher": { + "email": "migue.masx@gmail.com", + "name": "MiguelSavignano" + }, + "ref": "refs/heads/test-brakeman-errros", + "repository": { + "archive_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/assignees{/user}", + "blobs_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/branches{/branch}", + "clone_url": "https://github.com/MiguelSavignano/dockerize-rails.git", + "collaborators_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/comments{/number}", + "commits_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/commits{/sha}", + "compare_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/contents/{+path}", + "contributors_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/contributors", + "created_at": 1546466490, + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/deployments", + "description": "Example rails with docker, docker-compose and minikube. Use worker with sidekiq and nginx web server.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/downloads", + "events_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/events", + "fork": false, + "forks": 1, + "forks_count": 1, + "forks_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/forks", + "full_name": "MiguelSavignano/dockerize-rails", + "git_commits_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/git/tags{/sha}", + "git_url": "git://github.com/MiguelSavignano/dockerize-rails.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/hooks", + "html_url": "https://github.com/MiguelSavignano/dockerize-rails", + "id": 163894157, + "issue_comment_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/issues/events{/number}", + "issues_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/issues{/number}", + "keys_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/keys{/key_id}", + "labels_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/labels{/name}", + "language": "Ruby", + "languages_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/languages", + "license": null, + "master_branch": "master", + "merges_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/merges", + "milestones_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/milestones{/number}", + "mirror_url": null, + "name": "dockerize-rails", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjM4OTQxNTc=", + "notifications_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/notifications{?since,all,participating}", + "open_issues": 0, + "open_issues_count": 0, + "owner": { + "avatar_url": "https://avatars3.githubusercontent.com/u/6641863?v=4", + "email": "migue.masx@gmail.com", + "events_url": "https://api.github.com/users/MiguelSavignano/events{/privacy}", + "followers_url": "https://api.github.com/users/MiguelSavignano/followers", + "following_url": "https://api.github.com/users/MiguelSavignano/following{/other_user}", + "gists_url": "https://api.github.com/users/MiguelSavignano/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/MiguelSavignano", + "id": 6641863, + "login": "MiguelSavignano", + "name": "MiguelSavignano", + "node_id": "MDQ6VXNlcjY2NDE4NjM=", + "organizations_url": "https://api.github.com/users/MiguelSavignano/orgs", + "received_events_url": "https://api.github.com/users/MiguelSavignano/received_events", + "repos_url": "https://api.github.com/users/MiguelSavignano/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/MiguelSavignano/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/MiguelSavignano/subscriptions", + "type": "User", + "url": "https://api.github.com/users/MiguelSavignano" + }, + "private": false, + + "pulls_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/pulls{/number}", + "pushed_at": 1571872407, + "releases_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/releases{/id}", + "size": 249, + "ssh_url": "git@github.com:MiguelSavignano/dockerize-rails.git", + "stargazers": 1, + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/stargazers", + "statuses_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/subscribers", + "subscription_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/subscription", + "svn_url": "https://github.com/MiguelSavignano/dockerize-rails", + "tags_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/tags", + "teams_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/teams", + "trees_url": "https://api.github.com/repos/MiguelSavignano/dockerize-rails/git/trees{/sha}", + "updated_at": "2019-04-10T17:03:40Z", + "url": "https://github.com/MiguelSavignano/dockerize-rails", + "watchers": 1, + "watchers_count": 1 + }, + "sender": { + "avatar_url": "https://avatars3.githubusercontent.com/u/6641863?v=4", + "events_url": "https://api.github.com/users/MiguelSavignano/events{/privacy}", + "followers_url": "https://api.github.com/users/MiguelSavignano/followers", + "following_url": "https://api.github.com/users/MiguelSavignano/following{/other_user}", + "gists_url": "https://api.github.com/users/MiguelSavignano/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/MiguelSavignano", + "id": 6641863, + "login": "MiguelSavignano", + "node_id": "MDQ6VXNlcjY2NDE4NjM=", + "organizations_url": "https://api.github.com/users/MiguelSavignano/orgs", + "received_events_url": "https://api.github.com/users/MiguelSavignano/received_events", + "repos_url": "https://api.github.com/users/MiguelSavignano/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/MiguelSavignano/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/MiguelSavignano/subscriptions", + "type": "User", + "url": "https://api.github.com/users/MiguelSavignano" + } +} diff --git a/spec/fixtures/input.json b/spec/fixtures/input.json new file mode 100644 index 0000000..ee03e71 --- /dev/null +++ b/spec/fixtures/input.json @@ -0,0 +1,107 @@ +{ + "scan_info": { + "app_path": "/home/miguemasx/developer/dockerize-rails", + "rails_version": "5.2.2", + "security_warnings": 1, + "start_time": "2019-10-25 11:25:31 +0200", + "end_time": "2019-10-25 11:25:31 +0200", + "duration": 0.108293375, + "checks_performed": [ + "BasicAuth", + "BasicAuthTimingAttack", + "ContentTag", + "CookieSerialization", + "CreateWith", + "CrossSiteScripting", + "DefaultRoutes", + "Deserialize", + "DetailedExceptions", + "DigestDoS", + "DynamicFinders", + "EscapeFunction", + "Evaluation", + "Execute", + "FileAccess", + "FileDisclosure", + "FilterSkipping", + "ForgerySetting", + "HeaderDoS", + "I18nXSS", + "JRubyXML", + "JSONEncoding", + "JSONParsing", + "LinkTo", + "LinkToHref", + "MailTo", + "MassAssignment", + "MimeTypeDoS", + "ModelAttrAccessible", + "ModelAttributes", + "ModelSerialize", + "NestedAttributes", + "NestedAttributesBypass", + "NumberToCurrency", + "PermitAttributes", + "QuoteTableName", + "Redirect", + "RegexDoS", + "Render", + "RenderDoS", + "RenderInline", + "ResponseSplitting", + "RouteDoS", + "SQL", + "SQLCVEs", + "SSLVerify", + "SafeBufferManipulation", + "SanitizeMethods", + "SelectTag", + "SelectVulnerability", + "Send", + "SendFile", + "SessionManipulation", + "SessionSettings", + "SimpleFormat", + "SingleQuotes", + "SkipBeforeFilter", + "SprocketsPathTraversal", + "StripTags", + "SymbolDoSCVE", + "TranslateBug", + "UnsafeReflection", + "ValidationRegex", + "WithoutProtection", + "XMLDoS", + "YAMLParsing" + ], + "number_of_controllers": 2, + "number_of_models": 2, + "number_of_templates": 7, + "ruby_version": "2.6.3", + "brakeman_version": "4.7.0" + }, + "warnings": [ + { + "warning_type": "Mass Assignment", + "warning_code": 70, + "fingerprint": "5b486a498b14e1a12361c50863e2770c966799c9d5c6b6b9ab9bd8797c28a986", + "check_name": "MassAssignment", + "message": "Parameters should be whitelisted for mass assignment", + "file": "app/controllers/posts_controller.rb", + "line": 17, + "link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/", + "code": "params.permit!", + "render_path": null, + "location": { + "type": "method", + "class": "PostsController", + "method": "new" + }, + "user_input": null, + "confidence": "High" + } + ], + "ignored_warnings": [], + "errors": [], + "obsolete": [] +} diff --git a/spec/fixtures/report.json b/spec/fixtures/report.json deleted file mode 100644 index fedae6c..0000000 --- a/spec/fixtures/report.json +++ /dev/null @@ -1,3301 +0,0 @@ -{ - "metadata": { - "rubocop_version": "0.75.1", - "ruby_engine": "ruby", - "ruby_version": "2.6.3", - "ruby_patchlevel": "62", - "ruby_platform": "x86_64-linux" - }, - "files": [ - { - "path": "Gemfile", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [83/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 50, - "start_column": 81, - "last_line": 50, - "last_column": 83, - "length": 3, - "line": 50, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Use `%i` or `%I` for an array of symbols.", - "cop_name": "Style/SymbolArray", - "corrected": false, - "location": { - "start_line": 51, - "start_column": 28, - "last_line": 51, - "last_column": 53, - "length": 26, - "line": 51, - "column": 28 - } - }, - { - "severity": "convention", - "message": "Line is too long. [98/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 55, - "start_column": 81, - "last_line": 55, - "last_column": 98, - "length": 18, - "line": 55, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem `listen` should appear before `web-console`.", - "cop_name": "Bundler/OrderedGems", - "corrected": false, - "location": { - "start_line": 57, - "start_column": 3, - "last_line": 57, - "last_column": 35, - "length": 33, - "line": 57, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Line is too long. [130/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 58, - "start_column": 81, - "last_line": 58, - "last_column": 130, - "length": 50, - "line": 58, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Use `%i` or `%I` for an array of symbols.", - "cop_name": "Style/SymbolArray", - "corrected": false, - "location": { - "start_line": 72, - "start_column": 31, - "last_line": 72, - "last_column": 66, - "length": 36, - "line": 72, - "column": 31 - } - } - ] - }, - { - "path": "Rakefile", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [90/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 2, - "start_column": 81, - "last_line": 2, - "last_column": 90, - "length": 10, - "line": 2, - "column": 81 - } - } - ] - }, - { - "path": "app/channels/application_cable/channel.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/channels/application_cable/connection.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/controllers/application_controller.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/controllers/posts_controller.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Use `%i` or `%I` for an array of symbols.", - "cop_name": "Style/SymbolArray", - "corrected": false, - "location": { - "start_line": 2, - "start_column": 34, - "last_line": 2, - "last_column": 66, - "length": 33, - "line": 2, - "column": 34 - } - }, - { - "severity": "convention", - "message": "Put empty method definitions on a single line.", - "cop_name": "Style/EmptyMethod", - "corrected": false, - "location": { - "start_line": 12, - "start_column": 3, - "last_line": 13, - "last_column": 5, - "length": 14, - "line": 12, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Put empty method definitions on a single line.", - "cop_name": "Style/EmptyMethod", - "corrected": false, - "location": { - "start_line": 21, - "start_column": 3, - "last_line": 22, - "last_column": 5, - "length": 14, - "line": 21, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Line is too long. [83/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 31, - "start_column": 81, - "last_line": 31, - "last_column": 83, - "length": 3, - "line": 31, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [83/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 45, - "start_column": 81, - "last_line": 45, - "last_column": 83, - "length": 3, - "line": 45, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [87/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 59, - "start_column": 81, - "last_line": 59, - "last_column": 87, - "length": 7, - "line": 59, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Keep a blank line before and after `private`.", - "cop_name": "Layout/EmptyLinesAroundAccessModifier", - "corrected": false, - "location": { - "start_line": 64, - "start_column": 3, - "last_line": 64, - "last_column": 9, - "length": 7, - "line": 64, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Use 2 (not 4) spaces for indentation.", - "cop_name": "Layout/IndentationWidth", - "corrected": false, - "location": { - "start_line": 66, - "start_column": 1, - "last_line": 66, - "last_column": 4, - "length": 4, - "line": 66, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Inconsistent indentation detected.", - "cop_name": "Layout/IndentationConsistency", - "corrected": false, - "location": { - "start_line": 66, - "start_column": 5, - "last_line": 68, - "last_column": 7, - "length": 57, - "line": 66, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Line is too long. [88/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 70, - "start_column": 81, - "last_line": 70, - "last_column": 88, - "length": 8, - "line": 70, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Use 2 (not 4) spaces for indentation.", - "cop_name": "Layout/IndentationWidth", - "corrected": false, - "location": { - "start_line": 71, - "start_column": 1, - "last_line": 71, - "last_column": 4, - "length": 4, - "line": 71, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Inconsistent indentation detected.", - "cop_name": "Layout/IndentationConsistency", - "corrected": false, - "location": { - "start_line": 71, - "start_column": 5, - "last_line": 73, - "last_column": 7, - "length": 73, - "line": 71, - "column": 5 - } - } - ] - }, - { - "path": "app/helpers/application_helper.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level module documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 6, - "length": 6, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/helpers/posts_helper.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level module documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 6, - "length": 6, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/jobs/application_job.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/jobs/post_count_word_job.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/mailers/application_mailer.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/models/application_record.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/models/post.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Redundant `self` detected.", - "cop_name": "Style/RedundantSelf", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 36, - "last_line": 3, - "last_column": 42, - "length": 7, - "line": 3, - "column": 36 - } - } - ] - }, - { - "path": "app/views/posts/_post.json.jbuilder", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/views/posts/index.json.jbuilder", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "app/views/posts/show.json.jbuilder", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 15, - "last_line": 1, - "last_column": 26, - "length": 12, - "line": 1, - "column": 15 - } - } - ] - }, - { - "path": "bin/bundle", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "bin/rails", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Use `expand_path('spring', __dir__)` instead of `expand_path('../spring', __FILE__)`.", - "cop_name": "Style/ExpandPathArguments", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 13, - "last_line": 3, - "last_column": 23, - "length": 11, - "line": 3, - "column": 13 - } - } - ] - }, - { - "path": "bin/rake", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Use `expand_path('spring', __dir__)` instead of `expand_path('../spring', __FILE__)`.", - "cop_name": "Style/ExpandPathArguments", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 13, - "last_line": 3, - "last_column": 23, - "length": 11, - "line": 3, - "column": 13 - } - } - ] - }, - { - "path": "bin/setup", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "`include` is used at the top level. Use inside `class` or `module`.", - "cop_name": "Style/MixinUsage", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 1, - "last_line": 3, - "last_column": 17, - "length": 17, - "line": 3, - "column": 1 - } - } - ] - }, - { - "path": "bin/spring", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 11, - "start_column": 56, - "last_line": 11, - "last_column": 63, - "length": 8, - "line": 11, - "column": 56 - } - } - ] - }, - { - "path": "bin/update", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "`include` is used at the top level. Use inside `class` or `module`.", - "cop_name": "Style/MixinUsage", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 1, - "last_line": 3, - "last_column": 17, - "length": 17, - "line": 3, - "column": 1 - } - } - ] - }, - { - "path": "bin/webpack", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 5, - "last_line": 3, - "last_column": 15, - "length": 11, - "line": 3, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 26, - "last_line": 3, - "last_column": 35, - "length": 10, - "line": 3, - "column": 26 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 41, - "last_line": 3, - "last_column": 53, - "length": 13, - "line": 3, - "column": 41 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 5, - "last_line": 4, - "last_column": 14, - "length": 10, - "line": 4, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 22, - "last_line": 4, - "last_column": 34, - "length": 13, - "line": 4, - "column": 22 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 6, - "start_column": 9, - "last_line": 6, - "last_column": 18, - "length": 10, - "line": 6, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 5, - "last_line": 7, - "last_column": 20, - "length": 16, - "line": 7, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 44, - "last_line": 7, - "last_column": 58, - "length": 15, - "line": 7, - "column": 44 - } - }, - { - "severity": "convention", - "message": "Align the arguments of a method call if they span more than one line.", - "cop_name": "Layout/AlignArguments", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 3, - "last_line": 8, - "last_column": 33, - "length": 31, - "line": 8, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 10, - "start_column": 9, - "last_line": 10, - "last_column": 18, - "length": 10, - "line": 10, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 11, - "start_column": 9, - "last_line": 11, - "last_column": 23, - "length": 15, - "line": 11, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 13, - "start_column": 9, - "last_line": 13, - "last_column": 19, - "length": 11, - "line": 13, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 14, - "start_column": 9, - "last_line": 14, - "last_column": 34, - "length": 26, - "line": 14, - "column": 9 - } - } - ] - }, - { - "path": "bin/webpack-dev-server", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 5, - "last_line": 3, - "last_column": 15, - "length": 11, - "line": 3, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 26, - "last_line": 3, - "last_column": 35, - "length": 10, - "line": 3, - "column": 26 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 41, - "last_line": 3, - "last_column": 53, - "length": 13, - "line": 3, - "column": 41 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 5, - "last_line": 4, - "last_column": 14, - "length": 10, - "line": 4, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 22, - "last_line": 4, - "last_column": 34, - "length": 13, - "line": 4, - "column": 22 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 6, - "start_column": 9, - "last_line": 6, - "last_column": 18, - "length": 10, - "line": 6, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 5, - "last_line": 7, - "last_column": 20, - "length": 16, - "line": 7, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 44, - "last_line": 7, - "last_column": 58, - "length": 15, - "line": 7, - "column": 44 - } - }, - { - "severity": "convention", - "message": "Align the arguments of a method call if they span more than one line.", - "cop_name": "Layout/AlignArguments", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 3, - "last_line": 8, - "last_column": 33, - "length": 31, - "line": 8, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 10, - "start_column": 9, - "last_line": 10, - "last_column": 18, - "length": 10, - "line": 10, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 11, - "start_column": 9, - "last_line": 11, - "last_column": 23, - "length": 15, - "line": 11, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 13, - "start_column": 9, - "last_line": 13, - "last_column": 19, - "length": 11, - "line": 13, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 14, - "start_column": 9, - "last_line": 14, - "last_column": 37, - "length": 29, - "line": 14, - "column": 9 - } - } - ] - }, - { - "path": "bin/yarn", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Redundant `begin` block detected.", - "cop_name": "Style/RedundantBegin", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 3, - "last_line": 4, - "last_column": 7, - "length": 5, - "line": 4, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 5, - "start_column": 10, - "last_line": 5, - "last_column": 18, - "length": 9, - "line": 5, - "column": 10 - } - }, - { - "severity": "convention", - "message": "Use `warn` instead of `$stderr.puts` to allow such output to be disabled.", - "cop_name": "Style/StderrPuts", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 5, - "last_line": 7, - "last_column": 16, - "length": 12, - "line": 7, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 18, - "last_line": 7, - "last_column": 66, - "length": 49, - "line": 7, - "column": 18 - } - }, - { - "severity": "convention", - "message": "Use `warn` instead of `$stderr.puts` to allow such output to be disabled.", - "cop_name": "Style/StderrPuts", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 5, - "last_line": 8, - "last_column": 16, - "length": 12, - "line": 8, - "column": 5 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 18, - "last_line": 8, - "last_column": 71, - "length": 54, - "line": 8, - "column": 18 - } - } - ] - }, - { - "path": "config.ru", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/application.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 10, - "start_column": 3, - "last_line": 10, - "last_column": 7, - "length": 5, - "line": 10, - "column": 3 - } - }, - { - "severity": "convention", - "message": "Line is too long. [82/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 14, - "start_column": 81, - "last_line": 14, - "last_column": 82, - "length": 2, - "line": 14, - "column": 81 - } - } - ] - }, - { - "path": "config/boot.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/environment.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/environments/development.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [97/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 2, - "start_column": 81, - "last_line": 2, - "last_column": 97, - "length": 17, - "line": 2, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [85/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 81, - "last_line": 4, - "last_column": 85, - "length": 5, - "line": 4, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [86/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 32, - "start_column": 81, - "last_line": 32, - "last_column": 86, - "length": 6, - "line": 32, - "column": 81 - } - } - ] - }, - { - "path": "config/environments/production.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [97/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 2, - "start_column": 81, - "last_line": 2, - "last_column": 97, - "length": 17, - "line": 2, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [85/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 4, - "start_column": 81, - "last_line": 4, - "last_column": 85, - "length": 5, - "line": 4, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [87/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 19, - "start_column": 81, - "last_line": 19, - "last_column": 87, - "length": 7, - "line": 19, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [97/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 20, - "start_column": 81, - "last_line": 20, - "last_column": 97, - "length": 17, - "line": 20, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [102/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 34, - "start_column": 81, - "last_line": 34, - "last_column": 102, - "length": 22, - "line": 34, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [86/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 43, - "start_column": 81, - "last_line": 43, - "last_column": 86, - "length": 6, - "line": 43, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [96/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 49, - "start_column": 81, - "last_line": 49, - "last_column": 96, - "length": 16, - "line": 49, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [96/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 51, - "start_column": 81, - "last_line": 51, - "last_column": 96, - "length": 16, - "line": 51, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Do not use space inside array brackets.", - "cop_name": "Layout/SpaceInsideArrayLiteralBrackets", - "corrected": false, - "location": { - "start_line": 59, - "start_column": 22, - "last_line": 59, - "last_column": 22, - "length": 1, - "line": 59, - "column": 22 - } - }, - { - "severity": "convention", - "message": "Do not use space inside array brackets.", - "cop_name": "Layout/SpaceInsideArrayLiteralBrackets", - "corrected": false, - "location": { - "start_line": 59, - "start_column": 34, - "last_line": 59, - "last_column": 34, - "length": 1, - "line": 59, - "column": 34 - } - }, - { - "severity": "convention", - "message": "Line is too long. [83/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 64, - "start_column": 81, - "last_line": 64, - "last_column": 83, - "length": 3, - "line": 64, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [100/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 71, - "start_column": 81, - "last_line": 71, - "last_column": 100, - "length": 20, - "line": 71, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [83/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 86, - "start_column": 81, - "last_line": 86, - "last_column": 83, - "length": 3, - "line": 86, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 88, - "start_column": 10, - "last_line": 88, - "last_column": 30, - "length": 21, - "line": 88, - "column": 10 - } - } - ] - }, - { - "path": "config/environments/test.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [85/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 2, - "start_column": 81, - "last_line": 2, - "last_column": 85, - "length": 5, - "line": 2, - "column": 81 - } - } - ] - }, - { - "path": "config/initializers/application_controller_renderer.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/initializers/assets.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/initializers/backtrace_silencers.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [107/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 81, - "last_line": 3, - "last_column": 107, - "length": 27, - "line": 3, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [112/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 6, - "start_column": 81, - "last_line": 6, - "last_column": 112, - "length": 32, - "line": 6, - "column": 81 - } - } - ] - }, - { - "path": "config/initializers/content_security_policy.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [107/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 20, - "start_column": 81, - "last_line": 20, - "last_column": 107, - "length": 27, - "line": 20, - "column": 81 - } - } - ] - }, - { - "path": "config/initializers/cookies_serializer.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/initializers/filter_parameter_logging.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/initializers/inflections.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/initializers/mime_types.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "config/initializers/wrap_parameters.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [96/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 6, - "start_column": 81, - "last_line": 6, - "last_column": 96, - "length": 16, - "line": 6, - "column": 81 - } - } - ] - }, - { - "path": "config/puma.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 7, - "start_column": 27, - "last_line": 7, - "last_column": 45, - "length": 19, - "line": 7, - "column": 27 - } - }, - { - "severity": "convention", - "message": "Line is too long. [85/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 10, - "start_column": 81, - "last_line": 10, - "last_column": 85, - "length": 5, - "line": 10, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 12, - "start_column": 23, - "last_line": 12, - "last_column": 28, - "length": 6, - "line": 12, - "column": 23 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 16, - "start_column": 23, - "last_line": 16, - "last_column": 33, - "length": 11, - "line": 16, - "column": 23 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 16, - "start_column": 38, - "last_line": 16, - "last_column": 50, - "length": 13, - "line": 16, - "column": 38 - } - } - ] - }, - { - "path": "config/routes.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 5, - "start_column": 8, - "last_line": 5, - "last_column": 20, - "length": 13, - "line": 5, - "column": 8 - } - } - ] - }, - { - "path": "config/spring.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "db/migrate/20181227161008_create_posts.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "db/migrate/20181228000432_add_count_words_to_posts.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing top-level class documentation comment.", - "cop_name": "Style/Documentation", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 5, - "length": 5, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "db/schema.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [81/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 3, - "start_column": 81, - "last_line": 3, - "last_column": 81, - "length": 1, - "line": 3, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [86/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 81, - "last_line": 8, - "last_column": 86, - "length": 6, - "line": 8, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [86/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 11, - "start_column": 81, - "last_line": 11, - "last_column": 86, - "length": 6, - "line": 11, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Use underscores(_) as thousands separator and separate every 3 digits with them.", - "cop_name": "Style/NumericLiterals", - "corrected": false, - "location": { - "start_line": 13, - "start_column": 38, - "last_line": 13, - "last_column": 54, - "length": 17, - "line": 13, - "column": 38 - } - }, - { - "severity": "convention", - "message": "Extra empty line detected at block body beginning.", - "cop_name": "Layout/EmptyLinesAroundBlockBody", - "corrected": false, - "location": { - "start_line": 14, - "start_column": 1, - "last_line": 15, - "last_column": 0, - "length": 1, - "line": 14, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 16, - "start_column": 20, - "last_line": 16, - "last_column": 28, - "length": 9, - "line": 16, - "column": 20 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 18, - "start_column": 16, - "last_line": 18, - "last_column": 22, - "length": 7, - "line": 18, - "column": 16 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 19, - "start_column": 14, - "last_line": 19, - "last_column": 20, - "length": 7, - "line": 19, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 20, - "start_column": 14, - "last_line": 20, - "last_column": 19, - "length": 6, - "line": 20, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 21, - "start_column": 16, - "last_line": 21, - "last_column": 27, - "length": 12, - "line": 21, - "column": 16 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 22, - "start_column": 16, - "last_line": 22, - "last_column": 27, - "length": 12, - "line": 22, - "column": 16 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 23, - "start_column": 15, - "last_line": 23, - "last_column": 27, - "length": 13, - "line": 23, - "column": 15 - } - }, - { - "severity": "convention", - "message": "Extra empty line detected at block body end.", - "cop_name": "Layout/EmptyLinesAroundBlockBody", - "corrected": false, - "location": { - "start_line": 25, - "start_column": 1, - "last_line": 26, - "last_column": 0, - "length": 1, - "line": 25, - "column": 1 - } - } - ] - }, - { - "path": "db/seeds.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Line is too long. [103/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 81, - "last_line": 1, - "last_column": 103, - "length": 23, - "line": 1, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [111/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 2, - "start_column": 81, - "last_line": 2, - "last_column": 111, - "length": 31, - "line": 2, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Line is too long. [81/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 6, - "start_column": 81, - "last_line": 6, - "last_column": 81, - "length": 1, - "line": 6, - "column": 81 - } - } - ] - }, - { - "path": "test/application_system_test_case.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 9, - "last_line": 1, - "last_column": 21, - "length": 13, - "line": 1, - "column": 9 - } - } - ] - }, - { - "path": "test/controllers/posts_controller_test.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 8, - "last_line": 8, - "last_column": 25, - "length": 18, - "line": 8, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 13, - "start_column": 8, - "last_line": 13, - "last_column": 23, - "length": 16, - "line": 13, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 18, - "start_column": 8, - "last_line": 18, - "last_column": 27, - "length": 20, - "line": 18, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 26, - "start_column": 8, - "last_line": 26, - "last_column": 25, - "length": 18, - "line": 26, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 31, - "start_column": 8, - "last_line": 31, - "last_column": 24, - "length": 17, - "line": 31, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 36, - "start_column": 8, - "last_line": 36, - "last_column": 27, - "length": 20, - "line": 36, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Line is too long. [85/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 37, - "start_column": 81, - "last_line": 37, - "last_column": 85, - "length": 5, - "line": 37, - "column": 81 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 41, - "start_column": 8, - "last_line": 41, - "last_column": 28, - "length": 21, - "line": 41, - "column": 8 - } - } - ] - }, - { - "path": "test/jobs/post_count_word_job_test.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "test/models/post_test.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - } - ] - }, - { - "path": "test/system/posts_test.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 9, - "last_line": 1, - "last_column": 38, - "length": 30, - "line": 1, - "column": 9 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 8, - "start_column": 8, - "last_line": 8, - "last_column": 27, - "length": 20, - "line": 8, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 10, - "start_column": 21, - "last_line": 10, - "last_column": 24, - "length": 4, - "line": 10, - "column": 21 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 10, - "start_column": 33, - "last_line": 10, - "last_column": 39, - "length": 7, - "line": 10, - "column": 33 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 13, - "start_column": 8, - "last_line": 13, - "last_column": 24, - "length": 17, - "line": 13, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 15, - "start_column": 14, - "last_line": 15, - "last_column": 23, - "length": 10, - "line": 15, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 17, - "start_column": 13, - "last_line": 17, - "last_column": 18, - "length": 6, - "line": 17, - "column": 13 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 18, - "start_column": 13, - "last_line": 18, - "last_column": 19, - "length": 7, - "line": 18, - "column": 13 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 19, - "start_column": 14, - "last_line": 19, - "last_column": 26, - "length": 13, - "line": 19, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 21, - "start_column": 17, - "last_line": 21, - "last_column": 47, - "length": 31, - "line": 21, - "column": 17 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 22, - "start_column": 14, - "last_line": 22, - "last_column": 19, - "length": 6, - "line": 22, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 25, - "start_column": 8, - "last_line": 25, - "last_column": 24, - "length": 17, - "line": 25, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 27, - "start_column": 14, - "last_line": 27, - "last_column": 19, - "length": 6, - "line": 27, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 29, - "start_column": 13, - "last_line": 29, - "last_column": 18, - "length": 6, - "line": 29, - "column": 13 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 30, - "start_column": 13, - "last_line": 30, - "last_column": 19, - "length": 7, - "line": 30, - "column": 13 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 31, - "start_column": 14, - "last_line": 31, - "last_column": 26, - "length": 13, - "line": 31, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 33, - "start_column": 17, - "last_line": 33, - "last_column": 47, - "length": 31, - "line": 33, - "column": 17 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 34, - "start_column": 14, - "last_line": 34, - "last_column": 19, - "length": 6, - "line": 34, - "column": 14 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 37, - "start_column": 8, - "last_line": 37, - "last_column": 26, - "length": 19, - "line": 37, - "column": 8 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 40, - "start_column": 16, - "last_line": 40, - "last_column": 24, - "length": 9, - "line": 40, - "column": 16 - } - }, - { - "severity": "convention", - "message": "Prefer single-quoted strings when you don't need string interpolation or special symbols.", - "cop_name": "Style/StringLiterals", - "corrected": false, - "location": { - "start_line": 43, - "start_column": 17, - "last_line": 43, - "last_column": 49, - "length": 33, - "line": 43, - "column": 17 - } - } - ] - }, - { - "path": "test/test_helper.rb", - "offenses": [ - { - "severity": "convention", - "message": "Missing magic comment `# frozen_string_literal: true`.", - "cop_name": "Style/FrozenStringLiteralComment", - "corrected": false, - "location": { - "start_line": 1, - "start_column": 1, - "last_line": 1, - "last_column": 1, - "length": 1, - "line": 1, - "column": 1 - } - }, - { - "severity": "convention", - "message": "Use nested module/class definitions instead of compact style.", - "cop_name": "Style/ClassAndModuleChildren", - "corrected": false, - "location": { - "start_line": 5, - "start_column": 7, - "last_line": 5, - "last_column": 29, - "length": 23, - "line": 5, - "column": 7 - } - }, - { - "severity": "convention", - "message": "Line is too long. [82/80]", - "cop_name": "Metrics/LineLength", - "corrected": false, - "location": { - "start_line": 6, - "start_column": 81, - "last_line": 6, - "last_column": 82, - "length": 2, - "line": 6, - "column": 81 - } - } - ] - } - ], - "summary": { - "offense_count": 201, - "target_file_count": 54, - "inspected_file_count": 54 - } -} diff --git a/spec/github_check_run_service_spec.rb b/spec/github_check_run_service_spec.rb index 99833d0..300de70 100644 --- a/spec/github_check_run_service_spec.rb +++ b/spec/github_check_run_service_spec.rb @@ -1,11 +1,9 @@ -# frozen_string_literal: true - require './spec/spec_helper' describe GithubCheckRunService do - let(:rubocop_report) { JSON(File.read('./spec/fixtures/report.json')) } + let(:brakeman_report) { JSON(File.read('./spec/fixtures/input.json')) } let(:github_data) { { sha: 'sha', token: 'token', owner: 'owner', repo: 'repository_name' } } - let(:service) { GithubCheckRunService.new(rubocop_report, github_data, ReportAdapter) } + let(:service) { GithubCheckRunService.new(brakeman_report, github_data, ReportAdapter) } it '#run' do stub_request(:any, 'https://api.github.com/repos/owner/repository_name/check-runs/id') @@ -17,4 +15,5 @@ describe GithubCheckRunService do output = service.run expect(output).to be_a(Hash) end + end diff --git a/spec/report_adapter_spec.rb b/spec/report_adapter_spec.rb index 856a4e9..5efe47d 100644 --- a/spec/report_adapter_spec.rb +++ b/spec/report_adapter_spec.rb @@ -1,32 +1,31 @@ -# frozen_string_literal: true - require './spec/spec_helper' describe ReportAdapter do - let(:rubocop_report) do - JSON(File.read('./spec/fixtures/report.json')) - end + let(:brakeman_report) { + JSON(File.read('./spec/fixtures/input.json')) + } let(:adapter) { ReportAdapter } it '.conslusion' do - result = adapter.conslusion(rubocop_report) + result = adapter.conslusion(brakeman_report) expect(result).to eq('failure') end it '.summary' do - result = adapter.summary(rubocop_report) - expect(result).to eq('201 offense(s) found') + result = adapter.summary(brakeman_report) + expect(result).to be_a(String) end it '.annotations' do - result = adapter.annotations(rubocop_report) - expect(result.first).to eq( - 'path' => 'Gemfile', - 'start_line' => 1, - 'end_line' => 1, - 'annotation_level' => 'failure', - 'message' => 'Missing magic comment `# frozen_string_literal: true`.' - ) + result = adapter.annotations(brakeman_report) + expect(result).to eq([{ + 'path' => 'app/controllers/posts_controller.rb', + 'start_line' => 17, + 'annotation_level' => 'warning', + 'end_line' => 17, + 'title' => 'High - MassAssignment', + 'message' => 'Parameters should be whitelisted for mass assignment' + }]) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d37a172..79d7889 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require 'webmock/rspec' require 'json' require 'pry'