Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
haskell-gargantext
haskell-gargantext
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 179
    • Issues 179
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • gargantext
  • haskell-gargantexthaskell-gargantext
  • Issues
  • #387

Closed
Open
Opened Aug 20, 2024 by Grégoire Locqueville@glocqueville
  • Report abuse
  • New issue
Report abuse New issue

Remove dead code

Some code is unused in the database. As a couple obvious examples (unless I am missing something), a text search in the codebase suggests that the following modules are not imported anywhere:

  • Gargantext.Database.Action.TSQuery
  • Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams (only contains commented code)
  • Gargantext.Database.Query.Table.Node_NodeNgramsNodeNgrams (only contains commented code)

Those are just examples found by chance, there are probably more such modules.There is also a lot of commented code, and I suspect that there is some more dead code at lower levels of granularity (functions that are never called, pattern matching branches that are never selected).

This makes it significantly more difficult than needed to navigate the codebase as a newcomer.

Distinct but related issue about the dependency graph: #180

Tools

Some tools can help detecting dead code systematically:

  • Weeder tells you about dead code, but I don't know with which level of granularity (I don't think it inspects pattern matching branches, for instance).
    • From what I understand, @AlfredoDiNapoli has considered running Weeder but didn't find anything worth reporting on.
    • I converted his Weeder configuration from the former format .dhall into the current .toml, using the author's script. I am not going to make a merge request right now just for that, but here is the new config: weeder.toml
    • I managed to have Weeder run, but it seems faulty: one of the first functions it tells me to remove is startGargantext, which is obviously not dead code. Here is my (faulty) Weeder output for reference.
  • Calligraphy allows Haskell developers to see their codebase as a graph. This would be useful in a manual search for dead code, and would moreover be a good complement to human-written documentation. (Note that from the author's own admission, Calligraphy's output is not exhaustive, so it should only be treated as an exploration tool, not as sufficient evidence to remove code.)
    • I tried to run Calligraphy too, but only got No files matched your search criteria... It seems that I didn't manage to generate the correct .hie files.

Possible course of action

  • Discuss any possible reasons for the existence of dead code in the first place (maybe some of it is expected to be useful in future developments?), and decide whether it should be removed.
  • Manage to run Weeder to automatically detect some of the dead code
  • Manage to run Calligraphy and manually explore the codebase to find more dead code
  • Remove the dead code
Edited Aug 21, 2024 by Grégoire Locqueville
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: gargantext/haskell-gargantext#387