Giter VIP home page Giter VIP logo

code-peek's Introduction

Code Peek

Code Peek is a command-line tool written in Rust that helps you gain insights into your codebases. It recursively traverses a directory, counts the lines of code for each file, and provides a summarized output based on your preferences.

Features

  • Line Count: Get the line count for each file in the specified directory.
  • Top Files: Display the top N files with the highest line counts.
  • Grouping: Group the output by file extension or programming language.
  • Exclusions: Exclude specific files or patterns from the analysis using globs.
  • Git Integration: Get information about the number of commits made to each file.

Installation

Code Peek can be installed directly from the GitHub repository using cargo install (you need to have Rust installed):

cargo install --git https://github.com/DerTimonius/code-peek.git

This will download the latest version of Code Peek and install it in your Cargo bin directory (~/.cargo/bin/). Make sure that ~/.cargo/bin is in your system's PATH for easy access to the code-peek command.

Usage

code-peek [FLAGS] [OPTIONS] [ARGS]

Flags

  • -a, --all: Display all available information.
  • -g, --group: Group the results by file extension or programming language.
  • -t, --git: Get Git information (number of commits) for each file.
  • --skip-lockfiles: Skips lockfiles in analysis.

Options

  • -d, --dir : Directory to search (defaults to the current working directory).
  • -n, --num : Number of files to display (defaults to 10).
  • -e, --exclude : Globs to exclude files or directories other than those specified in the .gitignore file. Expects a comma-separated list (e.g., '*.txt,*.csv').
  • -m, --match : Globs to check, expects a comma separated list. E.g. '*.txt,*.csv' (Only files that match the pattern will be processed)

Examples

Display the top 10 files with the highest line counts in the current directory:

code-peek

Display the top 20 files in the /path/to/project directory, grouped by file extension:

code-peek -d /path/to/project -n 20 -g

Display all available information, excluding .txt and .csv files:

code-peek -a -e '*.txt,*.csv'

Display all available information, processing only Astro and Svelte files:

code-peek -a -m '*.astro,*.svelte'

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any improvements, bug fixes, or new features to propose.

License

Code Peek is licensed under the MIT License.

code-peek's People

Contributors

dertimonius avatar dependabot[bot] avatar

Stargazers

Karl Horky avatar David Maier avatar Michael Schulz avatar  avatar

Watchers

 avatar

code-peek's Issues

[FEAT] group lockfiles

Description

Lockfiles can become very large and monorepos might have multiple lockfiles that could skew the analysis. Therefore, these files should be grouped into its own FileType.

Technical Details

  • create a function that checks if a file is a lockfile (for example Cargo.lock, package-lock.json or pnpm-lock.yaml)
  • the function should then be used in the get_file_type function
  • also add a flag that lets the user filter out the lockfiles in the first place

[FEAT] add more languages to `FileType`

Description

Currently, only a handful of languages have been added to the FileType. A great list of languages with its according extension can be found here

Technical Details

  • add a new entry in the FileType enum
  • add a check for the language in the get_file_type function

Note: It's encouraged to add a maximum of 5 languages per PR

[FEAT] add file complexity

Description

The output with the -a or -t flag collects information about both file length and number of commits. Both could be combined to calculate the complexity or importance of a file. A smaller file that is changed often might be more important to a project than a large file that is only changed once per year.

Technical Details

  • add a function in impl File in file.rs that calculates the complexity
  • add the complexity to the tables in the grouped_info function
  • possibly also add an option to only display the complexity (needs a new flag in the clap command, and a new display function)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.