Overseas access: www.kdjingpai.com
Bookmark Us

fuck-u-codeis a dedicated code quality analysis tool designed to detect the complexity and messiness of a project's code and give it an intuitive "Shit Mountain Index" score. The tool runs locally and does not upload any code over the Internet, ensuring code security. It supports many major programming languages including Go, JavaScript/TypeScript, Python, Java, C/C++, and more.fuck-u-codeEvaluate code in seven core dimensions, such as cyclomatic complexity, function length and code repetition. One of its notable features is the ability to generate colorful endpoint reports that present the analysis results in a humorous way, making the code review process less boring. In addition, the tool supports exporting the analysis report to Markdown format, which is easy to integrate with AI tools (such as ChatGPT) or write into team documents.

Function List

  • Multi-language support: Support for analyzing Go, JavaScript/TypeScript, Python, Java, C/C++, Rust, and many other programming languages.
  • Shit Mountain Index Score: Provides a quality scoring system on a scale of 0 to 100. Higher scores represent poorer code quality.
  • Seven dimensions of detection: Evaluate code quality in seven areas: cyclomatic complexity, function length, comment coverage, error handling, naming conventions, code repetition, and code structure.
  • Color Terminal Report: Output analysis reports with colors and emoticons in the terminal, making the presentation of results more vivid and intuitive.
  • Markdown report output: Structured reports in Markdown format can be generated, making it easy for developers to use the analysis results for AI tool processing, document integration, or report generation in CI/CD processes.
  • Flexible configuration options: Users can customize the analysis behavior with command line options, such as displaying detailed reports, setting the number of problem files to display, excluding specific files or directories, etc.
  • local operation: The tool runs entirely in the local environment, does not require an Internet connection, and does not upload user code, ensuring the privacy and security of the code.

Using Help

fuck-u-code is a command-line tool whose main role is to analyze the project code under a specified path and give a detailed quality assessment report.

Installation process

You can choose any of the following three ways to install.

1. Direct installation from source code (recommended)
If your computer is already configured with the Go language environment, this is the easiest way to do it.

go install github.com/Done-0/fuck-u-code/cmd/fuck-u-code@latest

After running this command, make sure that Go'sbindirectory has been added to the system'sPATHin the environment variables. If the runtime promptscommand not found, you can execute the following command to set thebindirectory is added to thePATHin (Linux/Mac for example):

export PATH="$PATH:$(go env GOPATH)/bin"

In order to make this setting permanent, it is recommended to add the above line to your terminal's configuration file, for example.bash_profilemaybe.zshrcThe

2. Building from source code
If you want to compile it yourself, you can clone the code locally first.

# 克隆仓库
git clone https://github.com/Done-0/fuck-u-code.git
# 进入项目目录
cd fuck-u-code
# 编译生成可执行文件
go build -o fuck-u-code ./cmd/fuck-u-code

When the compilation is complete, it will generate a file in the current directory namedfuck-u-codeof the executable file.

3. Build with Docker
If you are familiar with Docker, you can also build an image with this tool via Dockerfile.

docker build -t fuck-u-code .

Usage

fundamental analysis
fuck-u-codeThe core command of theanalyze. You can specify a project path and the tool will start analyzing it.

# 分析指定路径的项目
fuck-u-code analyze /path/to/your/project

You can also omit the path if you are in a project folder and the tool will analyze the current directory by default.

# 分析当前目录
fuck-u-code analyze

If you are running with a Docker image, you need to mount your local project directory into the container.

# 使用Docker运行分析
docker run --rm -v "/path/to/your/project:/build" fuck-u-code analyze

Command Line Options
You can control the behavior of the analysis and output by adding different options.

options (as in computer software settings) simplify a book descriptive
--verbose -v Displays a very detailed analysis report with specific issues for each file.
--top N -t N Only the top N files with the worst problems are shown, the default is 5.
--issues N -i N Controls the display of up to N specific questions per file, the default is 5.
--summary -s Only the final summary conclusions and ratings are shown, not the detailed analysis process.
--markdown -m Format the output as Markdown instead of colored terminal text.
--lang -l Specify the output language of the report, currently supports Chinese (zh-CN) and English (en-US).
--exclude -e Excluding specific files or directories can be used multiple times. For example.--exclude "**/test/**"The
--skipindex -x When analyzing JavaScript/TypeScript projects, skip theindex.jsmaybeindex.tsDocumentation.

usage example
Here are some common usage scenarios.

  1. Conduct a detailed analysis
    fuck-u-code analyze --verbose
    
  2. Focus only on the worst 3 files
    fuck-u-code analyze --top 3
    
  3. Generate a Markdown report in English and save it to a file
    This feature is perfect for team collaboration and documentation.

    fuck-u-code analyze --markdown --lang en-US > report.md
    
  4. Quickly check code quality in Continuous Integration (CI)
    Just looking at the summary can be a quick way to determine if the code quality is up to par.

    fuck-u-code analyze --summary
    
  5. Exclude test files and dependent libraries from analysis
    fuck-u-code analyze --exclude "**/test/**" --exclude "**/vendor/**"
    

Advanced Usage: Combining AI Tools

--markdownThe options arefuck-u-codeA very useful feature. The Markdown report generated is clearly structured and contains an overall assessment, tables for each indicator, a list of problematic documents and suggestions for improvement.

You can copy the contents of this report directly to an AI tool (e.g. ChatGPT, Claude, etc.) and ask it questions, for example:

  • "Please help me analyze this code quality report."
  • "Give specific code refactoring suggestions for the problems mentioned in the report."
  • "Based on this report, please summarize the top three code quality issues that need to be prioritized for my team."

This can help you understand bad flavors in your code faster and get viable fixes.

application scenario

  1. Individual project self-study
    After completing a functional module or a personal project, developers can use this tool to do a comprehensive "checkup" of their code. By looking at the "Shit Mountain Index" and the list of specific problems, it can help developers refactor and optimize their code before it corrupts, and develop good coding habits.
  2. Team Code Review (Code Review)
    Code review is an important part of teamwork.fuck-u-codeIt can be used as a pre-review automation tool. Team members use it for self-checking before submitting the code, or attach the Markdown report to the merge request (Pull Request). This not only improves review efficiency, but also makes the discussion of code quality more objective and data-driven, avoiding subjective disputes.
  3. Evaluating maintenance costs of old projects (Shit Hill)
    When it is time to take over an old, unfamiliar project, you can use thefuck-u-codeQuickly perform a mapping of their code quality. The report generated gives a general idea of how severe the project's technical debt is, allowing for a more accurate assessment of the time and labor costs required for subsequent maintenance and refactoring.
  4. Integration into the CI/CD process
    It is possible to combinefuck-u-codeIntegrate into the continuous integration (CI) pipeline. For example, before code is merged into the master branch, a code quality analysis is automatically run. If the score falls below a set threshold, this merge is blocked. This creates an automated line of quality defense, ensuring that the team maintains a high level of code quality.

QA

  1. Will this tool upload my code? Is it safe?
    This tool is completely safe. It runs on your local computer and the entire analysis process does not require an Internet connection, much less any form of access or uploading of your code.
  2. How is the "Shit Mountain Index" score calculated? Is a higher score better?
    On the contrary, the higher the score, the worse the code quality and the more likely it is to be a "mountain of shit". The score is calculated based on seven dimensions (e.g., function length, code repetition, comment rate, etc.), with a score of 0 indicating very high code quality and a score of 100 indicating very bad code quality.
  3. Why do I get prompted after installing on Linux or Mac?command not found?
    This is usually because the Go language environmentbindirectory has not been added to the system'sPATHin the environment variable. You need to add it in manually. You can execute theexport PATH="$PATH:$(go env GOPATH)/bin"and add this line to your terminal's configuration file (e.g..zshrcmaybe.bash_profile) to make it permanent.
  4. What programming languages does this tool support?
    It currently supports a wide range of mainstream languages, including Go, JavaScript/TypeScript, Python, Java, C/C++, and Rust.
  5. When analyzing front-end projects, thenode_modulesDo you count the files in it?
    It won't. The tool already excludes some common front-end project dependencies and build product directories by default, such as thenode_modules,dist,buildas well as some compressed JS files (e.g..min.js) to ensure the accuracy of the analyzed results.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish