Repository navigation
Add fprime-util sloc: context-aware SLOC counting with FPP support - #30
Closed
devin-ai-integration[bot] wants to merge 8 commits into
Closed
devin-ai-integration[bot] wants to merge 8 commits into
devin-ai-integration[bot] wants to merge 8 commits into
Conversation
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Author
Original prompt from michael.d.starch
|
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| tokens.update( | ||
| LIBRARY_TOKEN_PATTERN.findall(link_file.read_text(errors="replace")) | ||
| ) | ||
| except Exception: |
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
…losure Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
…error, exclude build-artifacts Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
… per-language other buckets Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Author
|
Closing fork PR; work is being submitted upstream to nasa/fprime-tools. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
Adds a new
fprime-util sloccommand that counts source lines of code using pygount, plus a Pygments lexer plugin so.fpp/.fppifiles are recognized.src/fprime/util/sloc.py): any directory whoseCMakeLists.txtcontainsregister_fprime_*,add_library, oradd_executableis a module; files are attributed to the nearest owning module. Build caches (CMakeCache.txt,.fprime-build-dir,build-fprime*), hidden dirs, and git submodules (unless--include-submodules) are excluded from source scans.fprime, eachlibrary_locationslibrary, and the project, with per-section totals and a grand total (no cache required)--recursive→ counts recursively from the current directory (cache required)src/fprime/fpp/lexer.py):RegexLexerhandling#comments,@annotations, strings, numbers, FPP keywords/types; registered via apygments.lexersentry point inpyproject.tomlso pygount picks it up automatically.--markdown-reportand--json-report.test/tests/utdirectories) is reported in a separate UT column; AC counts appear only when a build cache is used.Rationale
Projects need repeatable SLOC accounting for F Prime framework, libraries, and project code — segmented by module and section, working with or without a generated build cache, and including autocoded output when available.
Testing/Review Recommendations
pytest test/fprime/util/test_sloc.py(module discovery, cache exclusion, UT separation, rollups, renderers) — full suite: 162 passed.Svc/CmdDispatcher), full root scan (~27 s), a builtTestDeploymentsProject/Refdeployment with AC counts,--recursivewith a cache, and the clean error when--recursive/deployment lacks a cache.black --check(25.1.0, matching CI) is clean.link.txt/build.ninjaforlib<name>.*tokens) and the set of languages excluded from counting.Future Work
Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/2196176199c144bbb4dd358947bfc228
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/2196176199c144bbb4dd358947bfc228?variant=devin