Skip to content

Multiple Codecheckers aren't supported by the codecheck.py script #8

@dxL1nus

Description

@dxL1nus

So I have the problem, that when I have multiple codecheckers listed in my codecheck.yml, that the functions in codecheck.py only expect a single codechecker, although the initial self.conf data structure in the codecheck.py script has indeed an Array of Codecheckers.

Example codechecker content in the codecheck.yml:

codechecker:
  - name: Linus Dexter Hackel
    ORCID: 0009-0000-0114-8005
  - name: Test Checker
    ORCID: 0123-4567-8910-1112
   

When I now want to convert the Notebook with the provided Command:

jupyter nbconvert --to pdf --no-input --no-prompt --execute --LatexExporter.template_file nbconvert_template.tex.j2 codecheck.ipynb

I get the following Error Message:

TypeError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 check.summary_table()

File ~/Code/CODECHECK/certificate-2025-026/codecheck/codecheck.py:98, in Codecheck.summary_table(self)
     85         """
     86         Markdown table with the general information (title, authors, etc.) from the `codecheck.yml`
     87         file.
     88         """
     89         summary_header = """
     90 Item | Value
     91 :--- | :----
     92 """
     93         summary_rows = [
     94             f"Title | *{self.conf['paper']['title']}*",
     95             f"Authors | {', '.join([name_orcid(a) for a in self.conf['paper']['authors']])}",
     96             f"Reference | [{self.conf['paper']['reference'].split('://')[1]}]({self.conf['paper']['reference']})",
     97             f"Repository | [{self.conf['repository'].split('://')[1]}]({self.conf['repository']})",
---> 98             f"Codechecker | {name_orcid(self.conf['codechecker'])}",
     99             f"Date of check | {datetime.fromisoformat(self.conf['check_time']).date()}",
    100             f"Summary | {self.conf['summary'].strip()}",
    101         ]
    102         return Markdown(summary_header + "\n".join(summary_rows))

File ~/Code/CODECHECK/certificate-2025-026/codecheck/codecheck.py:18, in name_orcid(entry)
     16 def name_orcid(entry):
     17     """Helper function for Name + ORCID"""
---> 18     return f"{entry['name']} (ORCID: [{entry['ORCID']}](https://orcid.org/{entry['ORCID']}))"

TypeError: list indices must be integers or slices, not str

And just to confirm, that the issue is related to the problem, that the script can only handle a singular Codechecker and not multiple, I added this to the constructor of codecheck.py:

def __init__(self, manifest_file=op.join("..", "codecheck.yml"), validate=False, strict=False):
      # The normal contents of the __init__() method. I didn't change anything here

      # I added this right here at the very bottom of the __init__() method to only have one codechecker
      self.conf['codechecker'] = self.conf['codechecker'][0]

After adding this the compilation goes ahead as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions