prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Linting should fail if pipeline module file is edited
  In https://github.com/ewels/nf-core-methylseq/pull/2 I have edited a module file that was pulled from nf-core/modules. I shouldn't be allowed to do this.
  
  The linting warns me that something is amiss:
  
  ```
  │ bismark/align                            │ modules/nf-cor… │ Local copy of   │
  │                                          │                 │ module outdated │
  ```
  
  But it should be checking the git sha in `modules.json` and recognising that it doesn't match what it expects. Then throwing a hard error.
  
  Possible that the code for this is lurking in a PR that's waiting to be merged..
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `nf_core/modules/lint/module_changes.py`
  Content:
  ```
  1 """
  2 Check whether the content of a module has changed compared to the original repository
  3 """
  4 import os
  5 import requests
  6 import rich
  7 from nf_core.modules.lint import LintResult
  8 
  9 
  10 def module_changes(module_lint_object, module):
  11     """
  12     Checks whether installed nf-core modules have changed compared to the
  13     original repository
  14     Downloads the 'main.nf' and 'meta.yml' files for every module
  15     and compares them to the local copies
  16 
  17     If the module has a 'git_sha', the file content is checked against this sha
  18     """
  19     files_to_check = ["main.nf", "meta.yml"]
  20 
  21     # Loop over nf-core modules
  22     module_base_url = f"https://raw.githubusercontent.com/{module_lint_object.modules_repo.name}/{module_lint_object.modules_repo.branch}/modules/{module.module_name}/"
  23 
  24     # If module.git_sha specified, check specific commit version for changes
  25     if module.git_sha:
  26         module_base_url = f"https://raw.githubusercontent.com/{module_lint_object.modules_repo.name}/{module.git_sha}/modules/{module.module_name}/"
  27 
  28     for f in files_to_check:
  29         # open local copy, continue if file not found (a failed message has already been issued in this case)
  30         try:
  31             local_copy = open(os.path.join(module.module_dir, f), "r").read()
  32         except FileNotFoundError as e:
  33             continue
  34 
  35         # Download remote copy and compare
  36         url = module_base_url + f
  37         r = requests.get(url=url)
  38 
  39         if r.status_code != 200:
  40             module.warned.append(
  41                 (
  42                     "check_local_copy",
  43                     f"Could not fetch remote copy, skipping comparison.",
  44                     f"{os.path.join(module.module_dir, f)}",
  45                 )
  46             )
  47         else:
  48             try:
  49                 remote_copy = r.content.decode("utf-8")
  50 
  51                 if local_copy != remote_copy:
  52                     module.warned.append(
  53                         (
  54                             "check_local_copy",
  55                             "Local copy of module outdated",
  56                             f"{os.path.join(module.module_dir, f)}",
  57                         )
  58                     )
  59                 else:
  60                     module.passed.append(
  61                         (
  62                             "check_local_copy",
  63                             "Local copy of module up to date",
  64                             f"{os.path.join(module.module_dir, f)}",
  65                         )
  66                     )
  67             except UnicodeDecodeError as e:
  68                 module.warned.append(
  69                     (
  70                         "check_local_copy",
  71                         f"Could not decode file from {url}. Skipping comparison ({e})",
  72                         f"{os.path.join(module.module_dir, f)}",
  73                     )
  74                 )
  75
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/nf_core/modules/lint/module_changes.py b/nf_core/modules/lint/module_changes.py
  --- a/nf_core/modules/lint/module_changes.py
  +++ b/nf_core/modules/lint/module_changes.py
  @@ -49,10 +49,10 @@
                   remote_copy = r.content.decode("utf-8")
   
                   if local_copy != remote_copy:
  -                    module.warned.append(
  +                    module.failed.append(
                           (
                               "check_local_copy",
  -                            "Local copy of module outdated",
  +                            "Local copy of module does not match remote",
                               f"{os.path.join(module.module_dir, f)}",
                           )
                       )
  
verification_info: {"golden_diff": "diff --git a/nf_core/modules/lint/module_changes.py b/nf_core/modules/lint/module_changes.py\n--- a/nf_core/modules/lint/module_changes.py\n+++ b/nf_core/modules/lint/module_changes.py\n@@ -49,10 +49,10 @@\n                 remote_copy = r.content.decode(\"utf-8\")\n \n                 if local_copy != remote_copy:\n-                    module.warned.append(\n+                    module.failed.append(\n                         (\n                             \"check_local_copy\",\n-                            \"Local copy of module outdated\",\n+                            \"Local copy of module does not match remote\",\n                             f\"{os.path.join(module.module_dir, f)}\",\n                         )\n                     )\n", "issue": "Linting should fail if pipeline module file is edited\nIn https://github.com/ewels/nf-core-methylseq/pull/2 I have edited a module file that was pulled from nf-core/modules. I shouldn't be allowed to do this.\r\n\r\nThe linting warns me that something is amiss:\r\n\r\n```\r\n\u2502 bismark/align                            \u2502 modules/nf-cor\u2026 \u2502 Local copy of   \u2502\r\n\u2502                                          \u2502                 \u2502 module outdated \u2502\r\n```\r\n\r\nBut it should be checking the git sha in `modules.json` and recognising that it doesn't match what it expects. Then throwing a hard error.\r\n\r\nPossible that the code for this is lurking in a PR that's waiting to be merged..\n", "before_files": [{"content": "\"\"\"\nCheck whether the content of a module has changed compared to the original repository\n\"\"\"\nimport os\nimport requests\nimport rich\nfrom nf_core.modules.lint import LintResult\n\n\ndef module_changes(module_lint_object, module):\n    \"\"\"\n    Checks whether installed nf-core modules have changed compared to the\n    original repository\n    Downloads the 'main.nf' and 'meta.yml' files for every module\n    and compares them to the local copies\n\n    If the module has a 'git_sha', the file content is checked against this sha\n    \"\"\"\n    files_to_check = [\"main.nf\", \"meta.yml\"]\n\n    # Loop over nf-core modules\n    module_base_url = f\"https://raw.githubusercontent.com/{module_lint_object.modules_repo.name}/{module_lint_object.modules_repo.branch}/modules/{module.module_name}/\"\n\n    # If module.git_sha specified, check specific commit version for changes\n    if module.git_sha:\n        module_base_url = f\"https://raw.githubusercontent.com/{module_lint_object.modules_repo.name}/{module.git_sha}/modules/{module.module_name}/\"\n\n    for f in files_to_check:\n        # open local copy, continue if file not found (a failed message has already been issued in this case)\n        try:\n            local_copy = open(os.path.join(module.module_dir, f), \"r\").read()\n        except FileNotFoundError as e:\n            continue\n\n        # Download remote copy and compare\n        url = module_base_url + f\n        r = requests.get(url=url)\n\n        if r.status_code != 200:\n            module.warned.append(\n                (\n                    \"check_local_copy\",\n                    f\"Could not fetch remote copy, skipping comparison.\",\n                    f\"{os.path.join(module.module_dir, f)}\",\n                )\n            )\n        else:\n            try:\n                remote_copy = r.content.decode(\"utf-8\")\n\n                if local_copy != remote_copy:\n                    module.warned.append(\n                        (\n                            \"check_local_copy\",\n                            \"Local copy of module outdated\",\n                            f\"{os.path.join(module.module_dir, f)}\",\n                        )\n                    )\n                else:\n                    module.passed.append(\n                        (\n                            \"check_local_copy\",\n                            \"Local copy of module up to date\",\n                            f\"{os.path.join(module.module_dir, f)}\",\n                        )\n                    )\n            except UnicodeDecodeError as e:\n                module.warned.append(\n                    (\n                        \"check_local_copy\",\n                        f\"Could not decode file from {url}. Skipping comparison ({e})\",\n                        f\"{os.path.join(module.module_dir, f)}\",\n                    )\n                )\n", "path": "nf_core/modules/lint/module_changes.py"}], "after_files": [{"content": "\"\"\"\nCheck whether the content of a module has changed compared to the original repository\n\"\"\"\nimport os\nimport requests\nimport rich\nfrom nf_core.modules.lint import LintResult\n\n\ndef module_changes(module_lint_object, module):\n    \"\"\"\n    Checks whether installed nf-core modules have changed compared to the\n    original repository\n    Downloads the 'main.nf' and 'meta.yml' files for every module\n    and compares them to the local copies\n\n    If the module has a 'git_sha', the file content is checked against this sha\n    \"\"\"\n    files_to_check = [\"main.nf\", \"meta.yml\"]\n\n    # Loop over nf-core modules\n    module_base_url = f\"https://raw.githubusercontent.com/{module_lint_object.modules_repo.name}/{module_lint_object.modules_repo.branch}/modules/{module.module_name}/\"\n\n    # If module.git_sha specified, check specific commit version for changes\n    if module.git_sha:\n        module_base_url = f\"https://raw.githubusercontent.com/{module_lint_object.modules_repo.name}/{module.git_sha}/modules/{module.module_name}/\"\n\n    for f in files_to_check:\n        # open local copy, continue if file not found (a failed message has already been issued in this case)\n        try:\n            local_copy = open(os.path.join(module.module_dir, f), \"r\").read()\n        except FileNotFoundError as e:\n            continue\n\n        # Download remote copy and compare\n        url = module_base_url + f\n        r = requests.get(url=url)\n\n        if r.status_code != 200:\n            module.warned.append(\n                (\n                    \"check_local_copy\",\n                    f\"Could not fetch remote copy, skipping comparison.\",\n                    f\"{os.path.join(module.module_dir, f)}\",\n                )\n            )\n        else:\n            try:\n                remote_copy = r.content.decode(\"utf-8\")\n\n                if local_copy != remote_copy:\n                    module.failed.append(\n                        (\n                            \"check_local_copy\",\n                            \"Local copy of module does not match remote\",\n                            f\"{os.path.join(module.module_dir, f)}\",\n                        )\n                    )\n                else:\n                    module.passed.append(\n                        (\n                            \"check_local_copy\",\n                            \"Local copy of module up to date\",\n                            f\"{os.path.join(module.module_dir, f)}\",\n                        )\n                    )\n            except UnicodeDecodeError as e:\n                module.warned.append(\n                    (\n                        \"check_local_copy\",\n                        f\"Could not decode file from {url}. Skipping comparison ({e})\",\n                        f\"{os.path.join(module.module_dir, f)}\",\n                    )\n                )\n", "path": "nf_core/modules/lint/module_changes.py"}]}