@codyswann/lisa 1.36.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-overwrite/CLAUDE.md +1 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +2 -0
- package/dist/core/config.js.map +1 -1
- package/dist/detection/detectors/rails.d.ts +15 -0
- package/dist/detection/detectors/rails.d.ts.map +1 -0
- package/dist/detection/detectors/rails.js +34 -0
- package/dist/detection/detectors/rails.js.map +1 -0
- package/dist/detection/index.d.ts.map +1 -1
- package/dist/detection/index.js +2 -0
- package/dist/detection/index.js.map +1 -1
- package/package.json +2 -1
- package/rails/copy-contents/Gemfile +3 -0
- package/rails/copy-overwrite/.claude/rules/lisa.md +44 -0
- package/rails/copy-overwrite/.claude/rules/rails-conventions.md +176 -0
- package/rails/copy-overwrite/.claude/skills/action-controller-best-practices/SKILL.md +374 -0
- package/rails/copy-overwrite/.claude/skills/action-view-best-practices/SKILL.md +335 -0
- package/rails/copy-overwrite/.claude/skills/active-record-model-best-practices/SKILL.md +166 -0
- package/rails/copy-overwrite/.claude/skills/plan-add-test-coverage/SKILL.md +45 -0
- package/rails/copy-overwrite/.claude/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/rails/copy-overwrite/.claude/skills/plan-lower-code-complexity/SKILL.md +48 -0
- package/rails/copy-overwrite/.claude/skills/plan-reduce-max-lines/SKILL.md +46 -0
- package/rails/copy-overwrite/.claude/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/rails/copy-overwrite/.rubocop.yml +32 -0
- package/rails/copy-overwrite/.versionrc +48 -0
- package/rails/copy-overwrite/CLAUDE.md +56 -0
- package/rails/copy-overwrite/Gemfile.lisa +52 -0
- package/rails/copy-overwrite/config/initializers/version.rb +5 -0
- package/rails/copy-overwrite/lefthook.yml +20 -0
- package/rails/create-only/.github/workflows/ci.yml +11 -0
- package/rails/create-only/.github/workflows/quality.yml +96 -0
- package/rails/create-only/.github/workflows/release.yml +94 -0
- package/rails/create-only/.mise.toml +2 -0
- package/rails/create-only/.reek.yml +34 -0
- package/rails/create-only/.rspec +3 -0
- package/rails/create-only/.rubocop.local.yml +22 -0
- package/rails/create-only/.simplecov +20 -0
- package/rails/create-only/VERSION +1 -0
- package/rails/create-only/sonar-project.properties +15 -0
- package/rails/create-only/spec/rails_helper.rb +33 -0
- package/rails/create-only/spec/spec_helper.rb +21 -0
- package/rails/deletions.json +3 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
name: Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [main, dev, staging]
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
checks: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
lint:
|
|
17
|
+
name: Lint
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
bundler-cache: true
|
|
24
|
+
- run: bundle exec rubocop --format github
|
|
25
|
+
|
|
26
|
+
security:
|
|
27
|
+
name: Security
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
bundler-cache: true
|
|
34
|
+
- run: bundle exec brakeman --no-pager --quiet
|
|
35
|
+
- run: bundle exec bundler-audit check --update
|
|
36
|
+
|
|
37
|
+
# Default: PostgreSQL. For MySQL, replace the service block and env vars:
|
|
38
|
+
# services:
|
|
39
|
+
# mysql:
|
|
40
|
+
# image: mysql:8.0
|
|
41
|
+
# env:
|
|
42
|
+
# MYSQL_ROOT_PASSWORD: password
|
|
43
|
+
# MYSQL_DATABASE: test
|
|
44
|
+
# ports:
|
|
45
|
+
# - 3306:3306
|
|
46
|
+
# options: >-
|
|
47
|
+
# --health-cmd "mysqladmin ping -h localhost"
|
|
48
|
+
# --health-interval 10s
|
|
49
|
+
# --health-timeout 5s
|
|
50
|
+
# --health-retries 5
|
|
51
|
+
# env:
|
|
52
|
+
# RAILS_ENV: test
|
|
53
|
+
# PRIMARY_DB_HOST: 127.0.0.1
|
|
54
|
+
# DATABASE_NAME: test
|
|
55
|
+
# DATABASE_PASSWORD: password
|
|
56
|
+
# DATABASE_USER: root
|
|
57
|
+
# DATABASE_PORT: 3306
|
|
58
|
+
test:
|
|
59
|
+
name: Test
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
services:
|
|
62
|
+
postgres:
|
|
63
|
+
image: postgres:16
|
|
64
|
+
env:
|
|
65
|
+
POSTGRES_USER: postgres
|
|
66
|
+
POSTGRES_PASSWORD: postgres
|
|
67
|
+
POSTGRES_DB: test
|
|
68
|
+
ports:
|
|
69
|
+
- 5432:5432
|
|
70
|
+
options: >-
|
|
71
|
+
--health-cmd pg_isready
|
|
72
|
+
--health-interval 10s
|
|
73
|
+
--health-timeout 5s
|
|
74
|
+
--health-retries 5
|
|
75
|
+
env:
|
|
76
|
+
RAILS_ENV: test
|
|
77
|
+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/checkout@v4
|
|
80
|
+
- uses: ruby/setup-ruby@v1
|
|
81
|
+
with:
|
|
82
|
+
bundler-cache: true
|
|
83
|
+
- run: bin/rails db:prepare
|
|
84
|
+
- run: bundle exec rspec
|
|
85
|
+
|
|
86
|
+
code-quality:
|
|
87
|
+
name: Code Quality
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
- uses: ruby/setup-ruby@v1
|
|
92
|
+
with:
|
|
93
|
+
bundler-cache: true
|
|
94
|
+
- run: bundle exec reek app/ lib/
|
|
95
|
+
- run: bundle exec flog --all --group app/ lib/
|
|
96
|
+
- run: bundle exec flay app/ lib/
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, staging]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
name: Release
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: webfactory/ssh-agent@v0.9.0
|
|
17
|
+
with:
|
|
18
|
+
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
|
|
19
|
+
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
|
24
|
+
|
|
25
|
+
- name: Check for skip conditions
|
|
26
|
+
id: skip
|
|
27
|
+
run: |
|
|
28
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
29
|
+
|
|
30
|
+
# Skip if last commit is a version bump
|
|
31
|
+
if echo "$COMMIT_MSG" | grep -q "^chore(release):"; then
|
|
32
|
+
echo "skip=true" >> $GITHUB_OUTPUT
|
|
33
|
+
exit 0
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Skip promotion merges (environment branch → main) only on main
|
|
37
|
+
if [ "$GITHUB_REF_NAME" = "main" ]; then
|
|
38
|
+
ENV_BRANCHES="dev|staging"
|
|
39
|
+
|
|
40
|
+
# Message-based detection: merge commits
|
|
41
|
+
# Pattern: "Merge branch 'staging' into main"
|
|
42
|
+
if echo "$COMMIT_MSG" | grep -qiE "^Merge branch ['\"]?($ENV_BRANCHES)['\"]? into"; then
|
|
43
|
+
echo "skip=true" >> $GITHUB_OUTPUT
|
|
44
|
+
exit 0
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# Pattern: "Merge pull request #123 from org/staging"
|
|
48
|
+
if echo "$COMMIT_MSG" | grep -qiE "^Merge pull request.*from .*/($ENV_BRANCHES)$"; then
|
|
49
|
+
echo "skip=true" >> $GITHUB_OUTPUT
|
|
50
|
+
exit 0
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Git-based detection: squash/fast-forward promotions
|
|
54
|
+
for ENV_BRANCH in dev staging; do
|
|
55
|
+
git fetch origin "$ENV_BRANCH" 2>/dev/null || continue
|
|
56
|
+
if git merge-base --is-ancestor HEAD "origin/$ENV_BRANCH" 2>/dev/null; then
|
|
57
|
+
echo "skip=true" >> $GITHUB_OUTPUT
|
|
58
|
+
exit 0
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
echo "skip=false" >> $GITHUB_OUTPUT
|
|
64
|
+
|
|
65
|
+
- uses: actions/setup-node@v4
|
|
66
|
+
if: steps.skip.outputs.skip != 'true'
|
|
67
|
+
with:
|
|
68
|
+
node-version: '22'
|
|
69
|
+
|
|
70
|
+
- name: Configure Git
|
|
71
|
+
if: steps.skip.outputs.skip != 'true'
|
|
72
|
+
run: |
|
|
73
|
+
git config user.name "github-actions[bot]"
|
|
74
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
75
|
+
|
|
76
|
+
- name: Bump version and create tag
|
|
77
|
+
if: steps.skip.outputs.skip != 'true'
|
|
78
|
+
run: npx standard-version@9
|
|
79
|
+
|
|
80
|
+
- name: Push changes
|
|
81
|
+
if: steps.skip.outputs.skip != 'true'
|
|
82
|
+
run: |
|
|
83
|
+
git remote set-url origin git@github.com:${{ github.repository }}.git
|
|
84
|
+
git push --follow-tags origin ${{ github.ref_name }}
|
|
85
|
+
|
|
86
|
+
- name: Create GitHub Release
|
|
87
|
+
if: steps.skip.outputs.skip != 'true' && github.ref_name == 'main'
|
|
88
|
+
env:
|
|
89
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
90
|
+
run: |
|
|
91
|
+
VERSION=$(cat VERSION)
|
|
92
|
+
gh release create "v${VERSION}" \
|
|
93
|
+
--title "v${VERSION}" \
|
|
94
|
+
--generate-notes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
detectors:
|
|
3
|
+
IrresponsibleModule:
|
|
4
|
+
enabled: false
|
|
5
|
+
TooManyStatements:
|
|
6
|
+
max_statements: 10
|
|
7
|
+
TooManyInstanceVariables:
|
|
8
|
+
max_instance_variables: 6
|
|
9
|
+
TooManyMethods:
|
|
10
|
+
max_methods: 15
|
|
11
|
+
UtilityFunction:
|
|
12
|
+
public_methods_only: true
|
|
13
|
+
FeatureEnvy:
|
|
14
|
+
enabled: true
|
|
15
|
+
LongParameterList:
|
|
16
|
+
max_params: 4
|
|
17
|
+
|
|
18
|
+
directories:
|
|
19
|
+
'app/controllers':
|
|
20
|
+
InstanceVariableAssumption:
|
|
21
|
+
enabled: false
|
|
22
|
+
TooManyInstanceVariables:
|
|
23
|
+
enabled: false
|
|
24
|
+
'app/helpers':
|
|
25
|
+
UtilityFunction:
|
|
26
|
+
enabled: false
|
|
27
|
+
'app/jobs':
|
|
28
|
+
UtilityFunction:
|
|
29
|
+
enabled: false
|
|
30
|
+
'db/migrate':
|
|
31
|
+
IrresponsibleModule:
|
|
32
|
+
enabled: false
|
|
33
|
+
FeatureEnvy:
|
|
34
|
+
enabled: false
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Project-specific RuboCop overrides.
|
|
2
|
+
# This file is NOT managed by Lisa — edit freely.
|
|
3
|
+
# Add or override any RuboCop cops below.
|
|
4
|
+
|
|
5
|
+
# Align with Reek's UncommunicativeVariableName (which rejects single-char names)
|
|
6
|
+
Naming/RescuedExceptionsVariableName:
|
|
7
|
+
PreferredName: error
|
|
8
|
+
|
|
9
|
+
# Add staging to known environments if your app uses a staging Rails env
|
|
10
|
+
# Rails/UnknownEnv:
|
|
11
|
+
# Environments:
|
|
12
|
+
# - development
|
|
13
|
+
# - test
|
|
14
|
+
# - staging
|
|
15
|
+
# - production
|
|
16
|
+
|
|
17
|
+
# Auto-generated schema files can exceed block length limits
|
|
18
|
+
# Metrics/BlockLength:
|
|
19
|
+
# Exclude:
|
|
20
|
+
# - 'db/queue_schema.rb'
|
|
21
|
+
# - 'db/cable_schema.rb'
|
|
22
|
+
# - 'db/cache_schema.rb'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
SimpleCov.start 'rails' do
|
|
4
|
+
enable_coverage :branch
|
|
5
|
+
|
|
6
|
+
minimum_coverage line: 80, branch: 70
|
|
7
|
+
|
|
8
|
+
add_group 'Models', 'app/models'
|
|
9
|
+
add_group 'Controllers', 'app/controllers'
|
|
10
|
+
add_group 'Services', 'app/services'
|
|
11
|
+
add_group 'Jobs', 'app/jobs'
|
|
12
|
+
add_group 'Mailers', 'app/mailers'
|
|
13
|
+
add_group 'Serializers', 'app/serializers'
|
|
14
|
+
add_group 'Libraries', 'lib'
|
|
15
|
+
|
|
16
|
+
add_filter '/spec/'
|
|
17
|
+
add_filter '/config/'
|
|
18
|
+
add_filter '/db/'
|
|
19
|
+
add_filter '/vendor/'
|
|
20
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.1
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# SonarQube / SonarCloud configuration
|
|
2
|
+
# Update sonar.projectKey and sonar.organization for your project
|
|
3
|
+
|
|
4
|
+
sonar.projectKey=your-org_your-project
|
|
5
|
+
sonar.organization=your-org
|
|
6
|
+
|
|
7
|
+
sonar.sources=app,lib
|
|
8
|
+
sonar.tests=spec
|
|
9
|
+
sonar.exclusions=vendor/**/*,db/schema.rb,db/migrate/**/*,tmp/**/*,log/**/*,node_modules/**/*
|
|
10
|
+
|
|
11
|
+
sonar.ruby.coverage.reportPaths=coverage/.resultset.json
|
|
12
|
+
sonar.ruby.rubocop.reportPaths=rubocop-report.json
|
|
13
|
+
|
|
14
|
+
sonar.language=ruby
|
|
15
|
+
sonar.sourceEncoding=UTF-8
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
6
|
+
|
|
7
|
+
require_relative '../config/environment'
|
|
8
|
+
|
|
9
|
+
raise 'The Rails environment is running in production mode!' if Rails.env.production?
|
|
10
|
+
|
|
11
|
+
require 'rspec/rails'
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
15
|
+
rescue ActiveRecord::PendingMigrationError => e
|
|
16
|
+
raise e.to_s.strip
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
RSpec.configure do |config|
|
|
20
|
+
config.fixture_paths = [Rails.root.join('spec/fixtures')]
|
|
21
|
+
config.use_transactional_fixtures = true
|
|
22
|
+
config.infer_spec_type_from_file_location!
|
|
23
|
+
config.filter_rails_from_backtrace!
|
|
24
|
+
|
|
25
|
+
config.include FactoryBot::Syntax::Methods
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Shoulda::Matchers.configure do |config|
|
|
29
|
+
config.integrate do |with|
|
|
30
|
+
with.test_framework :rspec
|
|
31
|
+
with.library :rails
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'simplecov'
|
|
4
|
+
|
|
5
|
+
RSpec.configure do |config|
|
|
6
|
+
config.expect_with :rspec do |expectations|
|
|
7
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
config.mock_with :rspec do |mocks|
|
|
11
|
+
mocks.verify_partial_doubles = true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
15
|
+
config.filter_run_when_matching :focus
|
|
16
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
|
17
|
+
config.disable_monkey_patching!
|
|
18
|
+
config.order = :random
|
|
19
|
+
|
|
20
|
+
Kernel.srand config.seed
|
|
21
|
+
end
|