panolint-rails 0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +13 -0
- data/.github/workflows/dependabot-prs.yml +41 -0
- data/.github/workflows/tests.yml +12 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +54 -0
- data/brakeman.yml +13 -0
- data/panolint-rails-rubocop.yml +25 -0
- data/panolint-rails.gemspec +22 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eabecb526f72e01fc078002d2ffee5ce0cdda1d8e19c294fe4267a36d622dae0
|
4
|
+
data.tar.gz: a0a46683cf950c7ac987de944789e77a9caf3eac272a85afb9d06096ce6f3bcd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e4e211b1d8dbbac468238e27bfab59ed8d238fee82b2d54a9d79291da1e5d072356e5038dc9e206488d82b4955747567594013b64867e1c05ea944528b7afdb2
|
7
|
+
data.tar.gz: b4a07d9512749ac2283227d3955234e41c2bc85270ee0cac5a659b7198b2de648dca8c40e45104ea9a6a6467afa582a386d349f86049cc92065e927ef5148c37
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: Dependabot Pull Request
|
2
|
+
on:
|
3
|
+
pull_request_target:
|
4
|
+
types: [opened, synchronize, reopened, labeled]
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
if: startsWith(github.head_ref, 'dependabot/')
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- name: Get unique committers
|
11
|
+
id: unique-committers
|
12
|
+
run: echo "::set-output name=committers::$(gh pr view $PR_URL --json commits --jq '[.commits.[] | .authors.[] | .login] | unique')"
|
13
|
+
env:
|
14
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
15
|
+
GITHUB_TOKEN: ${{secrets.PANORAMA_BOT_RW_TOKEN}}
|
16
|
+
# The last step enables auto-merge in certain situations, but we don't want dependabots that require
|
17
|
+
# additional work to accidentally get merged before code review so we turn it off here.
|
18
|
+
- name: Disable auto-merge if there are commits from someone other than Dependabot
|
19
|
+
if: steps.unique-committers.outputs.committers != '["dependabot[bot]"]'
|
20
|
+
run: gh pr merge --disable-auto --merge "$PR_URL"
|
21
|
+
env:
|
22
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
23
|
+
GITHUB_TOKEN: ${{secrets.PANORAMA_BOT_RW_TOKEN}}
|
24
|
+
- name: Approve and merge Dependabot PRs for development dependencies
|
25
|
+
# Auto-merge the PR if either:
|
26
|
+
# a) it has the `development-dependencies` label, which we add for certain
|
27
|
+
# categories of PRs (see `.github/dependabot.yml`), OR
|
28
|
+
# b) Dependabot has categorized it as a `direct:development` dependency,
|
29
|
+
# meaning it's in the Gemfile in a `development` or `test` group
|
30
|
+
#
|
31
|
+
# Note that we also do nothing when the PR has already had auto-merge
|
32
|
+
# enabled, to prevent scenarios where this check runs many times (for
|
33
|
+
# instance, because removing `Needs QA` triggers another run, or because
|
34
|
+
# other PRs are merging and causing this to rebase and trigger another
|
35
|
+
# run) and then approves the PR many times, which is confusing and looks
|
36
|
+
# awkward.
|
37
|
+
if: ${{ github.actor == 'dependabot[bot]' && !github.event.pull_request.auto_merge }}
|
38
|
+
run: gh pr merge --auto --merge "$PR_URL" && gh pr review --approve "$PR_URL"
|
39
|
+
env:
|
40
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
41
|
+
GITHUB_TOKEN: ${{secrets.PANORAMA_BOT_RW_TOKEN}}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
name: Main
|
2
|
+
on: push
|
3
|
+
jobs:
|
4
|
+
ci:
|
5
|
+
name: CI
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- uses: actions/checkout@master
|
9
|
+
- uses: ruby/setup-ruby@v1
|
10
|
+
with:
|
11
|
+
bundler-cache: true
|
12
|
+
- run: bundle exec rubocop --config "$(bundle show panolint-ruby)/panolint-ruby-rubocop.yml"
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.4
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at oss@panoramaed.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023-present Panorama Education
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# panolint-rails
|
2
|
+
|
3
|
+
[![Build Status](https://github.com/panorama-ed/panolint-rails/workflows/Main/badge.svg)](https://github.com/panorama-ed/panolint-rails/actions)
|
4
|
+
|
5
|
+
A small gem containing rules for linting Ruby on Rails code at Panorama Education.
|
6
|
+
|
7
|
+
This gem inherits RuboCop configuration from [panolint-ruby](https://github.com/panorama-ed/panolint-ruby) so it should be used *in place of* (not in combination with) `panolint-ruby`.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```
|
14
|
+
gem "panolint-rails", git: "https://github.com/panorama-ed/panolint-rails.git", branch: "main"
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
**Do not install this gem from RubyGems**, as updates are only pushed to this repo. We have only pushed an initial version to RubyGems to avoid supply chain attacks from malicious squatters.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### `Brakeman`
|
26
|
+
|
27
|
+
You can use `panolint-rails`'s `brakeman` configuration in your project by pointing the `brakeman` run at the configuration file in this repo:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ bundle exec brakeman -c "$(bundle show brakeman)/brakeman.yml"
|
31
|
+
```
|
32
|
+
|
33
|
+
### `RuboCop`
|
34
|
+
|
35
|
+
You can use `panolint-rails`'s RuboCop configuration in your project with the following addition to the top of your project's `.rubocop.yml`:
|
36
|
+
|
37
|
+
```
|
38
|
+
inherit_gem:
|
39
|
+
panolint-rails: panolint-rails-rubocop.yml
|
40
|
+
```
|
41
|
+
|
42
|
+
This gem uses a gem-specific named file instead of the traditional `.rubocop.yml` due to a [previous issue](https://github.com/rubocop/rubocop/issues/4154#issuecomment-316004878) with RuboCop extensions in VS Code [reading the wrong repository's `.rubocop.yml` file](https://github.com/panorama-ed/panolint/pull/95).
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
While this gem is intended for internal use by Panorama Education engineers, bug reports and pull requests are welcome on GitHub at https://github.com/panorama-ed/panolint-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
51
|
+
|
52
|
+
## Code of Conduct
|
53
|
+
|
54
|
+
Everyone interacting in the `panolint-rails`'s project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/panorama-ed/panolint-rails/blob/master/CODE_OF_CONDUCT.md).
|
data/brakeman.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:ensure_latest: true # From brakeman --help: "Fail when Brakeman is outdated"
|
3
|
+
:run_all_checks: true # "Run all default and optional checks"
|
4
|
+
:branch_limit: -1 # "Limit depth of values in branches (-1 for no limit)"
|
5
|
+
|
6
|
+
# The Brakeman wiki says this option "enables deeper data flow analysis by
|
7
|
+
# allowing Brakeman to inspect called methods and attempt to determine the
|
8
|
+
# return value of the call."
|
9
|
+
:interprocedural: true
|
10
|
+
:additional_libs_path:
|
11
|
+
# This ensures Brakeman is run on all files, not just those in standard Rails
|
12
|
+
# directories.
|
13
|
+
- .
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# These are the default code conventions for Panorama Rails projects.
|
2
|
+
#
|
3
|
+
# You can use this in your project's .rubocop.yml with the following at the top:
|
4
|
+
#
|
5
|
+
# inherit_gem:
|
6
|
+
# panolint-rails: panolint-rails-rubocop.yml
|
7
|
+
#
|
8
|
+
# This allows you to selectively override settings in projects.
|
9
|
+
|
10
|
+
inherit_gem:
|
11
|
+
panolint-ruby: panolint-ruby-rubocop.yml
|
12
|
+
|
13
|
+
require:
|
14
|
+
- rubocop-performance
|
15
|
+
- rubocop-rails
|
16
|
+
- rubocop-rspec
|
17
|
+
|
18
|
+
AllCops:
|
19
|
+
Exclude:
|
20
|
+
- "db/schema.rb"
|
21
|
+
- "db/migrate/**/*"
|
22
|
+
NewCops: enable
|
23
|
+
|
24
|
+
Rails/I18nLocaleTexts:
|
25
|
+
Enabled: false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "panolint-rails"
|
5
|
+
spec.version = "0"
|
6
|
+
spec.authors = ["Amy Lieberman"]
|
7
|
+
spec.email = ["alieberman@panoramaed.com"]
|
8
|
+
|
9
|
+
spec.summary = "Rules for linting Rails code at Panorama Education. "\
|
10
|
+
"Use the latest git commit of this gem instead of the "\
|
11
|
+
"version pushed to RubyGems."
|
12
|
+
spec.homepage = "https://github.com/panorama-ed/panolint-rails"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.metadata = { "rubygems_mfa_required" => "true" }
|
15
|
+
|
16
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
17
|
+
`git ls-files -z`.split("\x0")
|
18
|
+
end
|
19
|
+
|
20
|
+
spec.add_dependency "brakeman", "5.4.1"
|
21
|
+
spec.add_dependency "rubocop-rails", "2.19.1"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: panolint-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Amy Lieberman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: brakeman
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.4.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.4.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.19.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.19.1
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- alieberman@panoramaed.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/dependabot.yml"
|
49
|
+
- ".github/workflows/dependabot-prs.yml"
|
50
|
+
- ".github/workflows/tests.yml"
|
51
|
+
- ".gitignore"
|
52
|
+
- ".ruby-version"
|
53
|
+
- CODE_OF_CONDUCT.md
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE
|
56
|
+
- README.md
|
57
|
+
- brakeman.yml
|
58
|
+
- panolint-rails-rubocop.yml
|
59
|
+
- panolint-rails.gemspec
|
60
|
+
homepage: https://github.com/panorama-ed/panolint-rails
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata:
|
64
|
+
rubygems_mfa_required: 'true'
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubygems_version: 3.3.7
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Rules for linting Rails code at Panorama Education. Use the latest git commit
|
84
|
+
of this gem instead of the version pushed to RubyGems.
|
85
|
+
test_files: []
|