Skip to content

Rewrite file_source and file_parser #102

Open
@Pennycook

Description

@Pennycook

Feature/behavior summary

These two files are large, complicated, and poorly documented. The desired functionality is actually very simple:

  • "Clean" source files, by stripping comments and combining whitespace.
  • Provide an iterator over some representation of the cleaned lines.

Request attributes

  • Would this be a refactor of existing code?
  • Does this proposal require new package dependencies?
  • Would this change break backwards compatibility?

Related issues

No response

Solution description

  • Replace file_source with a simpler approach, probably by re-using existing lexers.
  • Rewrite file_parser to use a simpler representation of the line_info and LineGroup objects.

Additional notes

We should explore implementing this functionality with pygments; it should be possible to iterate through tokens and discard the ones we don't want. This would also open up the opportunity to rewrite other parts of Code Base Investigator to use pygments tokens.

If we do use pygments, we'd be introducing a new dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions