Skip to content

Fix for First argument to super() is not enclosing class#5418

Closed
orbeckst wants to merge 1 commit into
developfrom
finding-autofix-865
Closed

Fix for First argument to super() is not enclosing class#5418
orbeckst wants to merge 1 commit into
developfrom
finding-autofix-865

Conversation

@orbeckst

@orbeckst orbeckst commented Jul 8, 2026

Copy link
Copy Markdown
Member

Fixes #

Changes made in this Pull Request:

Fixes incorrect call of super in the Janin analysis class.

This error was detected when doing a trial run of CodeQL, see https://github.com/MDAnalysis/mdanalysis/security/quality and in particular https://github.com/MDAnalysis/mdanalysis/security/quality/rules/py%2Fsuper-not-enclosing-class

The "generate fix" disregards our standard PR template and adds the text below. For compliance, I manually inserted the PR text from

LLM / AI generated code disclosure

LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes

The fix was auto-generated, i.e., full AI use. However, that was simply faster than me making the equivalent edit.

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)
  • LLM/AI disclosure was updated.

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.


Autofix-generated text

The fix is to make the super() call reference the enclosing class (Janin) so object initialization follows the correct MRO and calls the intended base-class constructor.

Best minimal fix (no behavior change beyond correcting initialization): in package/MDAnalysis/analysis/dihedrals.py, replace:

  • super(Ramachandran, self).__init__(...)

with:

  • super(Janin, self).__init__(...)

No new imports, methods, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@orbeckst orbeckst added AI-assisted Generated with significant AI/LLM assistance Component-Analysis labels Jul 8, 2026

@orbeckst orbeckst left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Manually fixing...

:attr:`angles` results are now stored in a
:class:`MDAnalysis.analysis.base.Results` instance.
"""
super(Ramachandran, self).__init__(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This looks horrible but is actually correct.

AnalysisBase's init is special so I also need to change the arguments when calling Ramachandran.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

additionally, Janin does not want to call Ramachandran's init; it's a bit of a mess

@orbeckst

Copy link
Copy Markdown
Member Author

It's actually correct as is. The code would need some refactoring or at least a comment...

@orbeckst orbeckst closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-assisted Generated with significant AI/LLM assistance Component-Analysis

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant