Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ jobs:

- name: Auto-correct RuboCop issues
working-directory: sinatra
run: bundle exec rubocop -A || true
run: bundle exec rubocop -A

- name: Run RuboCop
working-directory: sinatra
run: bundle exec rubocop || true
run: bundle exec rubocop

Comment on lines 65 to 72

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Running rubocop -A in CI silently rewrites code

rubocop -A performs in-place auto-corrections.
Because the CI workspace is thrown away, those changes are never committed, yet the step can pass while masking offences that needed manual review.

Safer pattern:

-      - name: Auto-correct RuboCop issues
-        working-directory: sinatra
-        run: bundle exec rubocop -A
-
-      - name: Run RuboCop
+      - name: Run RuboCop
         working-directory: sinatra
-        run: bundle exec rubocop
+        run: bundle exec rubocop --parallel

Developers can run rubocop -A locally; CI should only fail or pass.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Auto-correct RuboCop issues
working-directory: sinatra
run: bundle exec rubocop -A || true
run: bundle exec rubocop -A
- name: Run RuboCop
working-directory: sinatra
run: bundle exec rubocop || true
run: bundle exec rubocop
- name: Run RuboCop
working-directory: sinatra
run: bundle exec rubocop --parallel
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 67-67: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/ci.yaml around lines 65 to 72, the CI step runs `rubocop
-A` which auto-corrects code in place, but these changes are not committed and
can mask offenses. Remove the `rubocop -A` step from the CI workflow so it only
runs `rubocop` to check for offenses without modifying files. Developers can
still run `rubocop -A` locally to fix issues before committing.

# Job 3: Lint Dockerfiles
lint-docker:
Expand Down
26 changes: 26 additions & 0 deletions sinatra/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Disable specific cops for the entire project
AllCops:
Exclude:
- 'db/schema.rb'
- 'vendor/**/*'
- 'node_modules/**/*'

# Ignore line length warnings
Layout/LineLength:
Enabled: false

# Ignore warnings about blocks being too long
Metrics/BlockLength:
Enabled: false

# Ignore warnings about methods being too long
Metrics/MethodLength:
Enabled: false

# Ignore warnings about assignment, branch, and condition size
Metrics/AbcSize:
Enabled: false

# Ignore warnings about classes being too long
Metrics/ClassLength:
Enabled: false
Comment on lines +8 to +26

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Re-enable metrics cops instead of blanket disabling them

Turning off LineLength, BlockLength, MethodLength, AbcSize, and ClassLength removes most objective safeguards against large, complex, and unreadable code.
If the default thresholds are too strict, prefer custom limits:

-Layout/LineLength:
-  Enabled: false
+Layout/LineLength:
+  Max: 120        # or any project-agreed width

…repeat for the other cops with Max, Count, or ExcludedMethods instead of Enabled: false.

This keeps CI protection while giving the team flexibility.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Ignore line length warnings
Layout/LineLength:
Enabled: false
# Ignore warnings about blocks being too long
Metrics/BlockLength:
Enabled: false
# Ignore warnings about methods being too long
Metrics/MethodLength:
Enabled: false
# Ignore warnings about assignment, branch, and condition size
Metrics/AbcSize:
Enabled: false
# Ignore warnings about classes being too long
Metrics/ClassLength:
Enabled: false
# Ignore line length warnings
Layout/LineLength:
Max: 120 # or any project-agreed width
# Ignore warnings about blocks being too long
Metrics/BlockLength:
Enabled: false
# Ignore warnings about methods being too long
Metrics/MethodLength:
Enabled: false
# Ignore warnings about assignment, branch, and condition size
Metrics/AbcSize:
Enabled: false
# Ignore warnings about classes being too long
Metrics/ClassLength:
Enabled: false
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 26-26: no new line character at the end of file

(new-line-at-end-of-file)

🤖 Prompt for AI Agents
In sinatra/.rubocop.yml between lines 8 and 26, the metrics cops for LineLength,
BlockLength, MethodLength, AbcSize, and ClassLength are completely disabled by
setting Enabled to false. Instead of disabling them, re-enable these cops and
configure custom thresholds using parameters like Max, Count, or ExcludedMethods
to relax the rules as needed. This maintains code quality checks while allowing
flexibility, so replace Enabled: false with appropriate custom limit settings
for each cop.

2 changes: 1 addition & 1 deletion sinatra/views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<div class="footer">
<span>DynaSearch 🧨 &copy; 2025</span>
<a href="/about">About</a>
<a href="/about">About</a>
</div>
</div>
<%# Correct path for script located in public/js/search.js %>
Expand Down