Skip to content

feat: sync language extensions and manifest files with analysis CLI#107

Open
alerizzo wants to merge 1 commit into
masterfrom
sync-cli-language-extensions
Open

feat: sync language extensions and manifest files with analysis CLI#107
alerizzo wants to merge 1 commit into
masterfrom
sync-cli-language-extensions

Conversation

@alerizzo

Copy link
Copy Markdown

What

Adds the file extensions and manifest/lock filenames that the analysis CLI's LANGUAGE_CONFIG already recognizes but were missing from this source-of-truth Language.scala. Purely additive — no existing extension/file was removed or reassigned, and no extension collides with another language in the set.

This closes the gap uncovered while auditing the CLI's language detection against this repo: the CLI had drifted to a slightly richer set of extensions/manifests for a handful of languages. Rather than shrink the CLI, we bring the source of truth up to the same coverage.

Additions

Language Extra extensions Extra files
Erlang .hrl, .es, .escript rebar.config, rebar.lock
Fortran .f, .for, .f77, .f08
FSharp .fsi, .fsx paket.lock
Perl .pm, .pod, .perl, .t cpanfile, cpanfile.snapshot
R .rd, .rsx renv.lock, .Rprofile
HTML .htm, .xhtml
Prolog .pro, .prolog
Lisp .cl
Scratch .sb3
Lua .luau
Elm elm.json, elm-package.json
Julia Project.toml
OCaml dune-project

Worth a reviewer's eye

Two extras are broader than a single ecosystem and could be dropped if you'd rather keep this repo conservative:

  • Perl .t — Perl test files, but .t is also used by other tools (e.g. Terra/Turing).
  • Lisp .cl — Common Lisp, but .cl also denotes OpenCL kernels.

Neither collides with any other language currently in Languages.all, so languageByExtension stays unambiguous either way.

Testing

  • scalafmtAll applied.
  • codacy-plugins-apiJVM/test compiles and passes (LanguageSpec).

🤖 Generated with Claude Code

Add the extra file extensions and manifest/lock filenames that the
analysis CLI's LANGUAGE_CONFIG already recognizes but were missing from
this source of truth, so both stay in sync.

Extensions: Erlang (.hrl/.es/.escript), Fortran (.f/.for/.f77/.f08),
FSharp (.fsi/.fsx), Perl (.pm/.pod/.perl/.t), R (.rd/.rsx),
HTML (.htm/.xhtml), Prolog (.pro/.prolog), Lisp (.cl), Scratch (.sb3),
Lua (.luau).
Files: Erlang (rebar.config/rebar.lock), Elm (elm.json/elm-package.json),
FSharp (paket.lock), Perl (cpanfile/cpanfile.snapshot),
R (renv.lock/.Rprofile), Julia (Project.toml), OCaml (dune-project).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request expands the supported file extensions and configuration/lock files for several programming languages in Language.scala. Feedback suggests adding corresponding unit tests in LanguageSpec.scala to verify that these new extensions and manifest/lock files are correctly resolved.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +259 to +260
case object Erlang
extends Language(extensions = Set(".erl", ".hrl", ".es", ".escript"), files = Set("rebar.config", "rebar.lock"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While these additions are purely additive and align with the analysis CLI, we should add corresponding unit tests in LanguageSpec.scala to verify that these new extensions (e.g., .escript, .luau, .fsx) and manifest/lock files (e.g., rebar.config, paket.lock, .Rprofile, dune-project) are correctly resolved to their respective languages via Languages.forPath. This ensures correctness and prevents future regressions.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR synchronizes language definitions in Language.scala with the Codacy analysis CLI. The changes are generally consistent with the goal of ensuring the source-of-truth matches the CLI's detection logic. Codacy analysis indicates the code is up to standards.

However, there is a significant implementation gap regarding verification: no updates were made to the test suite (e.g., LanguageSpec) to cover the new extensions and manifest files. Furthermore, two minor gaps were identified in the R and Scratch language objects that should be addressed to ensure full coverage of those languages.

About this PR

  • The PR adds a significant number of new language-to-file mappings but does not include any updates to the test suite (e.g., LanguageSpec) to verify these new entries. Adding specific unit test cases for these additions is highly recommended to prevent future regressions and ensure the mapping logic works as intended for all 13 updated languages.

Test suggestions

  • Verify that the new Erlang extensions (.hrl, .es, .escript) and manifest files (rebar.config, rebar.lock) are correctly associated with the Erlang language object.
  • Verify that new Perl extensions (.pm, .pod, .perl, .t) and manifests (cpanfile, cpanfile.snapshot) are correctly mapped.
  • Verify that manifest/lock files for FSharp (paket.lock), R (renv.lock, .Rprofile), Julia (Project.toml), OCaml (dune-project), and Elm (elm.json, elm-package.json) are correctly detected.
  • Verify that additional extensions for Fortran, HTML, R, Scratch, Lua, Lisp, and Prolog are correctly mapped to their respective languages.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that the new Erlang extensions (.hrl, .es, .escript) and manifest files (rebar.config, rebar.lock) are correctly associated with the Erlang language object.
2. Verify that new Perl extensions (.pm, .pod, .perl, .t) and manifests (cpanfile, cpanfile.snapshot) are correctly mapped.
3. Verify that manifest/lock files for FSharp (paket.lock), R (renv.lock, .Rprofile), Julia (Project.toml), OCaml (dune-project), and Elm (elm.json, elm-package.json) are correctly detected.
4. Verify that additional extensions for Fortran, HTML, R, Scratch, Lua, Lisp, and Prolog are correctly mapped to their respective languages.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

case object Fortran extends Language(extensions = Set(".f90", ".f95", ".f03", ".f", ".for", ".f77", ".f08"))

case object R extends Language(extensions = Set(".r"))
case object R extends Language(extensions = Set(".r", ".rd", ".rsx"), files = Set("renv.lock", ".Rprofile"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: The standard extensions for R are uppercase .R (scripts) and .Rd (documentation). Since other definitions in this file are case-sensitive, these should be included to ensure files are correctly identified.

Suggested change
case object R extends Language(extensions = Set(".r", ".rd", ".rsx"), files = Set("renv.lock", ".Rprofile"))
case object R extends Language(extensions = Set(".r", ".R", ".Rd", ".rsx"), files = Set("renv.lock", ".Rprofile"))

case object R extends Language(extensions = Set(".r", ".rd", ".rsx"), files = Set("renv.lock", ".Rprofile"))

case object Scratch extends Language(extensions = Set(".scratch", ".sb", ".sprite", ".sb2", ".sprite2"))
case object Scratch extends Language(extensions = Set(".scratch", ".sb", ".sprite", ".sb2", ".sprite2", ".sb3"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Suggestion: Add the .sprite3 extension to maintain consistency with the other Scratch versions supported.

Suggested change
case object Scratch extends Language(extensions = Set(".scratch", ".sb", ".sprite", ".sb2", ".sprite2", ".sb3"))
case object Scratch extends Language(extensions = Set(".scratch", ".sb", ".sprite", ".sb2", ".sprite2", ".sb3", ".sprite3"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant