diff --git a/.all-contributorsrc b/.all-contributorsrc deleted file mode 100644 index a9f8b6c..0000000 --- a/.all-contributorsrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "files": [ - "README.md" - ], - "imageSize": 100, - "commit": false, - "contributors": [ - { - "login": "andrewmcodes", - "name": "Andrew Mason", - "avatar_url": "https://avatars1.githubusercontent.com/u/18423853?v=4", - "profile": "https://www.andrewmason.me/", - "contributions": [ - "infra", - "doc", - "code" - ] - } - ], - "contributorsPerLine": 7, - "projectName": "standardrb-action", - "projectOwner": "andrewmcodes", - "repoType": "github", - "repoHost": "https://github.com" -} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d26ff8e..a5f3f51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: build on: [push] diff --git a/.github/workflows/rubocop.yml b/.github/workflows/standard.yml similarity index 100% rename from .github/workflows/rubocop.yml rename to .github/workflows/standard.yml diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6388c25..74819ee 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at andrewmcodes@protonmail.com. All +reported by contacting the project team at support@andrewm.codes. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. @@ -68,9 +68,9 @@ members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +available at [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da37fde..7e16c1c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,7 @@ Hey, there! 👋 Any and all contributions are welcome. Please make sure to read the [code of conduct][code-of-conduct] before submitting issues or pull requests. To lend a helping hand: + * [Fork the repository](https://help.github.com/articles/fork-a-repo/) * Make your desired changes * [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) diff --git a/Gemfile b/Gemfile index 69ae0d0..773bd25 100644 --- a/Gemfile +++ b/Gemfile @@ -7,8 +7,7 @@ group :development do end group :test do - gem "json", "~> 2.2" - gem "pry", "~> 0.12.2" - gem "rspec", "~> 3.9.0" - gem "webmock", "~> 3.7", ">= 3.7.6" + gem "json", "~> 2.6.1" + gem "rspec", "~> 3.11.0" + gem "webmock", "~> 3.14" end diff --git a/Gemfile.lock b/Gemfile.lock index bf1ee33..764acf0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,34 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) - coderay (1.1.2) - crack (0.4.3) - safe_yaml (~> 1.0.0) - diff-lcs (1.3) - hashdiff (1.0.0) - json (2.2.0) - method_source (0.9.2) + crack (0.4.5) + rexml + diff-lcs (1.5.0) + hashdiff (1.0.1) + json (2.6.1) parallel (1.22.1) parser (3.1.2.0) ast (~> 2.4.1) - pry (0.12.2) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - public_suffix (4.0.1) - rainbow (3.0.0) + public_suffix (4.0.7) + rainbow (3.1.1) regexp_parser (2.3.0) rexml (3.2.5) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.11.0) + rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) + rspec-support (~> 3.11.0) + rspec-support (3.11.0) rubocop (1.27.0) parallel (~> 1.10) parser (>= 3.1.0.0) @@ -49,13 +44,12 @@ GEM rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.11.0) - safe_yaml (1.0.5) standard (1.10.0) rubocop (= 1.27.0) rubocop-performance (= 1.13.3) unicode-display_width (2.1.0) - webmock (3.7.6) - addressable (>= 2.3.6) + webmock (3.14.0) + addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -63,11 +57,10 @@ PLATFORMS ruby DEPENDENCIES - json (~> 2.2) - pry (~> 0.12.2) - rspec (~> 3.9.0) + json (~> 2.6.1) + rspec (~> 3.11.0) standard (~> 1.10) - webmock (~> 3.7, >= 3.7.6) + webmock (~> 3.14) BUNDLED WITH 2.2.33 diff --git a/LICENSE b/LICENSE index 4467078..f5863fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Andrew Mason +Copyright (c) 2019-2022 Andrew Mason Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 4dc37a7..f43742f 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,6 @@ A GitHub Action to run [StandardRB](https://github.com/testdouble/standard) against your code and create annotations in the GitHub UI. -- [:white_check_mark: StandardRB Action](#whitecheckmark-standardrb-action) - - [:page_facing_up: Introduction](#pagefacingup-introduction) - - [:bulb: Usage](#bulb-usage) - - [:package: Example Workflow](#package-example-workflow) - - [:warning: Gotchas](#warning-gotchas) - - [:camera_flash: Screenshots](#cameraflash-screenshots) - - [:bookmark: Changelog](#bookmark-changelog) - - [:sos: Contributing](#sos-contributing) - - [:rotating_light: Code of Conduct](#rotatinglight-code-of-conduct) - - [:copyright: License](#copyright-license) - - [:robot: Check Out My Other Ruby GitHub Actions](#robot-check-out-my-other-ruby-github-actions) - - [✨ Contributors](#%e2%9c%a8-contributors) - ## :page_facing_up: Introduction GitHub Actions are an amazing new tool that can dramatically improve productivity while using the GitHub platform. While it is not hard to write a custom GitHub action to run StandardRB on your codebase, this action takes that functionality one step further using the checks API. After the StandardRB Linter Action runs StandardRB against your code, it will create annotations that you can easily view, matched up with the offending code. @@ -87,25 +74,3 @@ Due to the GitHub Check Runs API, we can only return 50 annotations per run. See ## :copyright: License [MIT](/LICENSE.md) - -## :robot: Check Out My Other Ruby GitHub Actions - -- [andrewmcodes/rubocop-linter-action](https://github.com/andrewmcodes/rubocop-linter-action). -- [andrewmcodes/haml-lint-action](https://github.com/andrewmcodes/haml-lint-action). - - -## ✨ Contributors - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - -
Andrew Mason
Andrew Mason

🚇 📖 💻
- - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/lib/github_check_run_service.rb b/lib/github_check_run_service.rb index ffd13cd..65d364d 100644 --- a/lib/github_check_run_service.rb +++ b/lib/github_check_run_service.rb @@ -36,7 +36,7 @@ def base_payload(status) name: CHECK_NAME, head_sha: @github_data[:sha], status: status, - started_at: Time.now.iso8601, + started_at: Time.now.iso8601 } end @@ -50,7 +50,7 @@ def update_check_payload output: { title: CHECK_NAME, summary: @summary, - annotations: @annotations, + annotations: @annotations } ) end diff --git a/lib/github_client.rb b/lib/github_client.rb index 58ae8fc..698469e 100644 --- a/lib/github_client.rb +++ b/lib/github_client.rb @@ -23,9 +23,9 @@ def post(url, body = {}) def headers @headers ||= { "Content-Type": "application/json", - "Accept": "application/vnd.github.antiope-preview+json", - "Authorization": "Bearer #{@github_token}", - "User-Agent": @user_agent, + Accept: "application/vnd.github.antiope-preview+json", + Authorization: "Bearer #{@github_token}", + "User-Agent": @user_agent } end diff --git a/lib/index.rb b/lib/index.rb index 99e39d2..f62c18e 100644 --- a/lib/index.rb +++ b/lib/index.rb @@ -16,7 +16,7 @@ def read_json(path) sha: ENV["GITHUB_SHA"], token: ENV["GITHUB_TOKEN"], owner: ENV["GITHUB_REPOSITORY_OWNER"] || @event_json.dig("repository", "owner", "login"), - repo: ENV["GITHUB_REPOSITORY_NAME"] || @event_json.dig("repository", "name"), + repo: ENV["GITHUB_REPOSITORY_NAME"] || @event_json.dig("repository", "name") } @report = if ENV["REPORT_PATH"] diff --git a/lib/report_adapter.rb b/lib/report_adapter.rb index d4c86d5..95bbe15 100644 --- a/lib/report_adapter.rb +++ b/lib/report_adapter.rb @@ -8,7 +8,7 @@ class << self "convention" => "failure", "warning" => "warning", "error" => "failure", - "fatal" => "failure", + "fatal" => "failure" }.freeze def conclusion(report) @@ -33,13 +33,13 @@ def annotations(report) same_line = location["start_line"] == location["last_line"] annotation_list.push( { - 'path': file["path"], - 'start_line': location["start_line"], - 'end_line': location["last_line"], - 'start_column': (location["start_column"] if same_line), - 'end_column': (location["last_column"] if same_line), - 'annotation_level': annotation_level(offense["severity"]), - 'message': offense["message"], + path: file["path"], + start_line: location["start_line"], + end_line: location["last_line"], + start_column: (location["start_column"] if same_line), + end_column: (location["last_column"] if same_line), + annotation_level: annotation_level(offense["severity"]), + message: offense["message"] }.compact.transform_keys!(&:to_s) ) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 71e622b..8dceae4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,6 @@ require "webmock/rspec" require "json" -require "pry" require "./lib/report_adapter" require "./lib/github_check_run_service" require "./lib/github_client"