Giter VIP home page Giter VIP logo

rohaquinlop / complexipy Goto Github PK

View Code? Open in Web Editor NEW
109.0 109.0 4.0 685 KB

An extremely fast Python library to calculate the cognitive complexity of Python files, written in Rust.

Home Page: https://rohaquinlop.github.io/complexipy/

License: MIT License

Python 46.51% Rust 53.49%
ci-cd cognitve-complexity maintainability metrics metrics-evaluation python rust sonar-scan understandability

complexipy's Introduction

Hi, I'm Robin ๐Ÿ‘‹๐Ÿพ

Software Engineer, (Rust, Open-Source) contributor.

Creator of

Project โš™๏ธ Description ๐Ÿ“ Badges ๐Ÿ›ก๏ธ
complexipy An extremely fast Python library to calculate the cognitive complexity of python files, written in Rust Downloads Downloads
automathon A Python library for simulating and visualizing finite automata Downloads
compare-files A simple CLI tool to compare two files. Written in Rust

Open-Source Highlights

Project โš™๏ธ PR ๐Ÿ”จ
Rust PR - 109418
terraform-aws-gitlab-runner PR - 962
Makes Role: Maintainer, added new features and improved the project

complexipy's People

Contributors

korneevm avatar rohaquinlop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

complexipy's Issues

Show progress bar

During the analysis show a progress bar with the information of the analysis

enhance output

When using the details option, in some cases there are no output to show on the tables, then the table shouldn't be printed, instead should show a message saying that everything is fine according to the analysis.

Add parameter to reduce the verbosity

The generation of the output table should be optional, due that Python is slower than Rust the generation of the tables seems to be slow with a lot of files.

Feature Request: Sort Output by Complexity

I'd like to propose adding the option to sort the output by the complexity, perhaps via an -s/--sort option.

When analyzing a large project for the first time, this could help finding the worst offenders quickly.

I suggest sorting the complexity in an ascending order by default since one sees the last entries first when printed to the terminal.

Fix algorithm

When writing a try/except count on the amount of exceptions.

try:
    ...
except ...:
    ...
except: ...:
    ...

Check how is being calculated the elif statement, it should be considered at the "same" level as the previous if statement

def has_sequence(value: str, sequence_size: int = 3) -> bool:
    if len(value) < sequence_size or sequence_size <= 0:
        return False

    sequence: list[int] = [ord(value[0])]
    is_increasing = False
    for char in value[1:]:
        current_ord: int = ord(char)

        if sequence[-1] + 1 == current_ord:
            if len(sequence) == 1:
                is_increasing = True
            sequence = sequence_increasing(
                char, current_ord, sequence, is_increasing
            )
        elif sequence[-1] - 1 == current_ord:
            if len(sequence) == 1:
                is_increasing = False
            sequence = sequence_decreasing(
                char, current_ord, sequence, is_increasing
            )
        else:
            sequence = [current_ord]

        if len(sequence) == sequence_size:
            return True

    return False

When assigning with an increase operation is counting incorrectly

a = a + 1 # 0
b = a + 2 # 0

bug: cannot install complexipy

Hi, complexipy seems super cool/useful, but I'm struggling to get it installed. Running pip install complexipy gives me the following error:

โžœ  pip install complexipy
Collecting complexipy
  Using cached complexipy-0.3.2.tar.gz (22 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  ร— Preparing metadata (pyproject.toml) did not run successfully.
  โ”‚ exit code: 1
  โ•ฐโ”€> [15 lines of output]
      error: failed to select a version for `env_logger`.
          ... required by package `complexipy v0.3.2 (/private/var/folders/wx/0d9m1sq12992h4fxxwf4fpf00000gn/T/pip-install-fa1nou7v/complexipy_5a3f8d99f5f74c59b7863bfc1472c7bf)`
      versions that meet the requirements `^0.11.1` (locked to 0.11.1) are: 0.11.1
      
      the package `complexipy` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
       It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.
      
      
      failed to select a version for `env_logger` which could resolve this conflict
      ๐Ÿ’ฅ maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/private/var/folders/wx/0d9m1sq12992h4fxxwf4fpf00000gn/T/pip-modern-metadata-tap0eiff', '--interpreter', '/Users/cameronbrill/.pyenv/versions/3.8.5/bin/python3.8']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /private/var/folders/wx/0d9m1sq12992h4fxxwf4fpf00000gn/T/pip-modern-metadata-tap0eiff --interpreter /Users/cameronbrill/.pyenv/versions/3.8.5/bin/python3.8`
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

ร— Encountered error while generating package metadata.
โ•ฐโ”€> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I am running on an Apple M1 Max Macbook pro on MacOS 14.4.1. My python version is 3.8.5. Am I missing some setup step?

ignore files

add the option to ignore some files or directories, for example ignore pycache and other directories similar to gitignore

Add Nix

Add nix to the repo, so the users can make use of the library with nix

Refactor the return types

I was thinking to return different types from main, when using the functions level, then return a list of functions instead of the list of files, make use of Either in Rust.

Support multiple paths

When calling complexipy should be able to handle multiple paths, for example:

complexipy /home/user/complexipy /home/user/documents/test.py -d low

And generate just a report, with the information, also, when there are no values on the table then the summary shouldn't be printed

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.