Skip to content

Add DeprecatedJobBaseClass cop#54

Merged
vishnu-m merged 4 commits into
mainfrom
feat/legacy-job-inheritance-cop
Apr 2, 2026
Merged

Add DeprecatedJobBaseClass cop#54
vishnu-m merged 4 commits into
mainfrom
feat/legacy-job-inheritance-cop

Conversation

@vishnu-m
Copy link
Copy Markdown
Member

@vishnu-m vishnu-m commented Apr 2, 2026

Summary

  • add Neeto/DeprecatedJobBaseClass
  • flag jobs inheriting from NeetoCommonsBackend::BaseJobs::*
  • allow latency class definitions and neeto-commons base job definitions
  • add specs and README/default config updates

Testing

  • bundle exec rspec spec/rubocop/cop/neeto/deprecated_job_base_class_spec.rb
  • bundle exec rubocop lib/rubocop/cop/neeto/deprecated_job_base_class.rb spec/rubocop/cop/neeto/deprecated_job_base_class_spec.rb

@neetodeploy neetodeploy Bot temporarily deployed to rubocop-neeto-ljhq-pr-54 April 2, 2026 13:01 Inactive
Copy link
Copy Markdown

@neeto-bugwatch neeto-bugwatch Bot left a comment

Choose a reason for hiding this comment

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

🤖 NeetoBugWatch Review

I've analyzed your pull request and found some potential improvements that might be worth considering. Please review the specific line comments below for helpful suggestions.

💡 To trigger a re-review of this PR, add a comment with the keyword neeto-bugwatch-run anywhere in the comment body.

Warning

Verdict: Needs review — 2 comments found, including major issues

Click to copy prompt for AI agent
Verdict: review_required

The following are code review comments from an AI reviewer that only has access
to the PR diff, not the full codebase. Treat every comment as a hypothesis,
not a fact. For each comment:

1. Investigate the verification questions against the full codebase first.
2. Go beyond the provided questions. Use your full codebase access to ask your
   own questions, check related code paths, and consider edge cases that the
   reviewer could not have seen from the diff alone.
3. Only implement the suggested fix if your investigation confirms the issue is real.
4. If the issue is not real, skip it entirely. Do not implement speculative fixes.

Prioritize by severity (critical > major > minor > trivial) and confidence score.
Only attend to comments with confidence below 0.5 if your investigation proves them valid.

[
  {
    "file_path": "lib/rubocop/cop/neeto/legacy_job_inheritance.rb",
    "line_number": 54,
    "comment": "Calling `const_name` on a `const` node might raise a `NoMethodError` if the constant's namespace is a dynamic expression (e.g., `class Job < self::Base` or `class Job < method_call::Base`). In these cases, RuboCop attempts to recursively call `const_name` on the namespace node, which may not define it, leading to a crash for the entire file parse.\n\nTo prevent potential RuboCop crashes, ensure the constant extraction handles non-constant namespaces safely.",
    "confidence": 0.85,
    "severity": "major",
    "suggested_fix": "Consider using a `NodePattern` to safely match the superclass structure, or fall back to `superclass.source` (stripping leading `::` and spaces) instead of `const_name`.",
    "verification_questions": [
      "Could a job in the codebase or a dependent project dynamically inherit from a namespace using `self` or a method call?",
      "Does `RuboCop::AST::ConstNode#const_name` in your current version handle non-const namespaces safely without raising exceptions?"
    ]
  },
  {
    "file_path": "lib/rubocop/cop/neeto/legacy_job_inheritance.rb",
    "line_number": 51,
    "comment": "Consider using `node.parent_class` instead of `node.children[1]`. The `RuboCop::AST::ClassNode` provides `parent_class` as a more expressive and idiomatic API for accessing the superclass node.",
    "confidence": 0.95,
    "severity": "trivial",
    "suggested_fix": "Replace `node.children[1]` with `node.parent_class` to improve code readability and rely on RuboCop's robust AST methods.",
    "verification_questions": [
      "Does the version of `rubocop-ast` used by this project support the `parent_class` method on `ClassNode`?"
    ]
  }
]

Comment thread lib/rubocop/cop/neeto/deprecated_job_base_class.rb
Comment thread lib/rubocop/cop/neeto/legacy_job_inheritance.rb Outdated
@neetodeploy neetodeploy Bot temporarily deployed to rubocop-neeto-ljhq-pr-54 April 2, 2026 13:15 Inactive
@vishnu-m vishnu-m changed the title Add cop for legacy job inheritance Add DeprecatedJobBaseClass cop Apr 2, 2026
@vishnu-m vishnu-m added backend Deals with Ruby & Rails code majorly. patch labels Apr 2, 2026
@neetodeploy neetodeploy Bot temporarily deployed to rubocop-neeto-ljhq-pr-54 April 2, 2026 13:43 Inactive
@vishnu-m vishnu-m merged commit 8f5ea21 into main Apr 2, 2026
1 check passed
@vishnu-m vishnu-m deleted the feat/legacy-job-inheritance-cop branch April 2, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Deals with Ruby & Rails code majorly. patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant