rolint


Namerolint JSON
Version 0.1.10 PyPI version JSON
download
home_pageNone
SummaryRoLint - A multi-language linter for safe robotic software development (C, C++, Python)
upload_time2025-09-13 14:13:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT
keywords linter robotics static-analysis c cpp python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RoLint Compliance Checker And Linter

<p align="center">
 <img width="300" height="500" alt="Rolint_Logo" src="https://github.com/user-attachments/assets/318bd375-e821-4a63-91ef-9e9a4cf12fde" />
</p>


RoLint is designed to be a robust and strict linter for robotics / embedded systems. It was originally developed for the Humanoid Robot Project at Worcester Polytechnic Institute.
This Linter is designed with MISRA-C, MISRA-C++, PEP8, and The Power Of 10 Standards in mind. Below is how to install and use RoLint, as well as an overview of the rules for the linter.

## UPDATE 0.1.9:  

### Changes to RoLint for the 0.1.10 update:  
> Bug Fixes:  
> > Raised minimum python version to 3.12  
> > Fixed rolint: ignore bug where it would ignore the comment instead of the intended line itself.  
> > Fixed versioning issue in pyproject.toml, leading to some issues with versioning and causing traceback issues.    
> > Structs no longer have false positive issue with implicit casting.  
> > Fixed default statement bug in C/C++

> Features:  
> > Flags: Ignores / Overrides are now flagged and appear in stdout.  
> > JSON: Updated JSON output to support flags.  
> > Stdout: Cleaned up STDOUT, made it easy to discern between flags and violations.  

### Roadmap / Future Features:  
> Using Rich formatting for clean output to console
> rolint: extern flag to tell rolint an extern var doesn't need initialization here

## Installation of RoLint

RoLint is registtered on PyPi, and you can install it with  

 > **pip install rolint**

This will install the RoLint linter.
Additionally, you can install by cloning the github for the project at https://github.com/MaceTheWindu66/RoLint

## How to Use RoLint


> rolint check [OPTIONS] [PATH] <-- Runs the linter on file[s] in specified path.  
> rolint set-config [OPTIONS] <-- Changes configuration as specified in options.  
> rolint show-config <-- Shows current configuration.  

For C/C++, RoLint is to be ran on an uncompiled C/C++ file. RoLint is not built to run off of C/C++ binaries, however their text files. RoLint should be used in conjunction with a compiler for most effective results. The rules for common compilers and this linter have overlap, but cover slightly different areas. 

### Options for Check Command

When linting a specific file using the check command, options must be defined. These options define the language and output. 

> #### Options:
> 
> > --lang c | cpp | python  <-- Specifies language    
> > --output | json <-- Changes output format   
> > --output-path -p | [PATH] <-- Overrides output path if output specified.   
>  
> #### Examples:
> >
> > rolint check --output json -p results.json main.c  

## Ignore/Override Features

RoLint comes with an override feature built in for all 3 languages.  
> " rolint: ignore" <-- Ignores the next line  
> " rolint: ignore-block" <-- Ignores a code block

For example, RoLint will ignore a for loop, and all of the code inside of the for loop, if rolint: ignore-block is commented immediately before the loop.  

### C/C++:  
> "// rolint: ignore"  
> "// rolint: ignore-block"  
### Python:  
> "# rolint: ignore"  
> "# rolint: ignore-block"  

## Overview of Rules

There are a lot of rules spanning over the 3 separate languages used for the original project that ROLINT was created for. These rules are primarily
based on MIRSA C/C++, The Power of 10, and PEP8 Standards.

### C Rules  
1. Certain unsafe standard library functions are banned to ensure safe memory operations. The current list is:
> gets, printf, fprintf, sprintf, vsprintf, strcpy, strncpy, strcat, strncat, scanf, sscanf, fscanf, strtok, atoi, atol, atof, atoll, setjmp, longjmp, malloc, calloc, free, realloc  
2. Only one variable can be declared per line.
3. Variables must be initialized when declared.
> int x; **<-- NOT ALLOWED**  
> int x = 5; **<-- ALLOWED**
4. Variables MUST be used if declared.
5. No global variables
6. Side effects are not permitted inside function calls
> EXAMPLE: printf(x++) **<-- NOT ALLOWED**  
7. No function-like macro definitions.
8. No implicit conversions in variable declarations or assignments
> int x = 3.14 **<-- NOT ALLOWED**
9. No narrowing casts
> Casting floats to ints, ints to shorts, etc.
10. No casting between pointer and arithmetic types
11. No recursion.
12. No break/continue statements in a switch statement (unless in a for loop).
13. Switch statements must have a default case.
14. No goto calls or unchecked jumps.
15. Header files must be guarded with an #ifndef statement.
16. Object definitions in header files are not permitted.

### C++ Rules
1. Unsafe standard library functions are banned, similar to C. Here is a list of the banned functions for C++:  
> malloc, calloc, realloc, free,
        printf, sprintf, scanf, gets, fgets,
        rand, srand, time, clock, gettimeofday,
        system, fork, exec, exit,
        va_start, va_arg, va_end,
        cin, cout, cerr, delete, new
2. Switch statements cannot have implicit fallthroughs (use break or [[fallthrough]])
3. Switch statements must have default statements
4. No continue statements
5. No uncontrolled jump statements, including goto
6. No function like macros

### Python Rules  
1. Code must follow PEP8 standards (flake8 used for PEP8 compliance checking).
2. All variables must be declared with static type hints.
  > x : int = 5
3. All functions must have a return annotation.  
> def func() -> int:
4. All function parameters must have static type hints.
> def func(x:int) -> int:
5. Certain inherently unsafe python functions (with regards to external code execution) are banned. The current list is:
> eval, exec, pickles
6. Threads used from python threading module must be joined.
7. Subprocesses must have a termination, wait, or communicate call to prevent zombie processes.





            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rolint",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "linter, robotics, static-analysis, c, cpp, python",
    "author": null,
    "author_email": "Maddux Berry <madduxberry31@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/53/08/2d670e8190d2d66e18b471c6fa3f8ffbbbba14c9e3ce9eb0c4b95894a451/rolint-0.1.10.tar.gz",
    "platform": null,
    "description": "# RoLint Compliance Checker And Linter\r\n\r\n<p align=\"center\">\r\n <img width=\"300\" height=\"500\" alt=\"Rolint_Logo\" src=\"https://github.com/user-attachments/assets/318bd375-e821-4a63-91ef-9e9a4cf12fde\" />\r\n</p>\r\n\r\n\r\nRoLint is designed to be a robust and strict linter for robotics / embedded systems. It was originally developed for the Humanoid Robot Project at Worcester Polytechnic Institute.\r\nThis Linter is designed with MISRA-C, MISRA-C++, PEP8, and The Power Of 10 Standards in mind. Below is how to install and use RoLint, as well as an overview of the rules for the linter.\r\n\r\n## UPDATE 0.1.9:  \r\n\r\n### Changes to RoLint for the 0.1.10 update:  \r\n> Bug Fixes:  \r\n> > Raised minimum python version to 3.12  \r\n> > Fixed rolint: ignore bug where it would ignore the comment instead of the intended line itself.  \r\n> > Fixed versioning issue in pyproject.toml, leading to some issues with versioning and causing traceback issues.    \r\n> > Structs no longer have false positive issue with implicit casting.  \r\n> > Fixed default statement bug in C/C++\r\n\r\n> Features:  \r\n> > Flags: Ignores / Overrides are now flagged and appear in stdout.  \r\n> > JSON: Updated JSON output to support flags.  \r\n> > Stdout: Cleaned up STDOUT, made it easy to discern between flags and violations.  \r\n\r\n### Roadmap / Future Features:  \r\n> Using Rich formatting for clean output to console\r\n> rolint: extern flag to tell rolint an extern var doesn't need initialization here\r\n\r\n## Installation of RoLint\r\n\r\nRoLint is registtered on PyPi, and you can install it with  \r\n\r\n > **pip install rolint**\r\n\r\nThis will install the RoLint linter.\r\nAdditionally, you can install by cloning the github for the project at https://github.com/MaceTheWindu66/RoLint\r\n\r\n## How to Use RoLint\r\n\r\n\r\n> rolint check [OPTIONS] [PATH] <-- Runs the linter on file[s] in specified path.  \r\n> rolint set-config [OPTIONS] <-- Changes configuration as specified in options.  \r\n> rolint show-config <-- Shows current configuration.  \r\n\r\nFor C/C++, RoLint is to be ran on an uncompiled C/C++ file. RoLint is not built to run off of C/C++ binaries, however their text files. RoLint should be used in conjunction with a compiler for most effective results. The rules for common compilers and this linter have overlap, but cover slightly different areas. \r\n\r\n### Options for Check Command\r\n\r\nWhen linting a specific file using the check command, options must be defined. These options define the language and output. \r\n\r\n> #### Options:\r\n> \r\n> > --lang c | cpp | python  <-- Specifies language    \r\n> > --output | json <-- Changes output format   \r\n> > --output-path -p | [PATH] <-- Overrides output path if output specified.   \r\n>  \r\n> #### Examples:\r\n> >\r\n> > rolint check --output json -p results.json main.c  \r\n\r\n## Ignore/Override Features\r\n\r\nRoLint comes with an override feature built in for all 3 languages.  \r\n> \" rolint: ignore\" <-- Ignores the next line  \r\n> \" rolint: ignore-block\" <-- Ignores a code block\r\n\r\nFor example, RoLint will ignore a for loop, and all of the code inside of the for loop, if rolint: ignore-block is commented immediately before the loop.  \r\n\r\n### C/C++:  \r\n> \"// rolint: ignore\"  \r\n> \"// rolint: ignore-block\"  \r\n### Python:  \r\n> \"# rolint: ignore\"  \r\n> \"# rolint: ignore-block\"  \r\n\r\n## Overview of Rules\r\n\r\nThere are a lot of rules spanning over the 3 separate languages used for the original project that ROLINT was created for. These rules are primarily\r\nbased on MIRSA C/C++, The Power of 10, and PEP8 Standards.\r\n\r\n### C Rules  \r\n1. Certain unsafe standard library functions are banned to ensure safe memory operations. The current list is:\r\n> gets, printf, fprintf, sprintf, vsprintf, strcpy, strncpy, strcat, strncat, scanf, sscanf, fscanf, strtok, atoi, atol, atof, atoll, setjmp, longjmp, malloc, calloc, free, realloc  \r\n2. Only one variable can be declared per line.\r\n3. Variables must be initialized when declared.\r\n> int x; **<-- NOT ALLOWED**  \r\n> int x = 5; **<-- ALLOWED**\r\n4. Variables MUST be used if declared.\r\n5. No global variables\r\n6. Side effects are not permitted inside function calls\r\n> EXAMPLE: printf(x++) **<-- NOT ALLOWED**  \r\n7. No function-like macro definitions.\r\n8. No implicit conversions in variable declarations or assignments\r\n> int x = 3.14 **<-- NOT ALLOWED**\r\n9. No narrowing casts\r\n> Casting floats to ints, ints to shorts, etc.\r\n10. No casting between pointer and arithmetic types\r\n11. No recursion.\r\n12. No break/continue statements in a switch statement (unless in a for loop).\r\n13. Switch statements must have a default case.\r\n14. No goto calls or unchecked jumps.\r\n15. Header files must be guarded with an #ifndef statement.\r\n16. Object definitions in header files are not permitted.\r\n\r\n### C++ Rules\r\n1. Unsafe standard library functions are banned, similar to C. Here is a list of the banned functions for C++:  \r\n> malloc, calloc, realloc, free,\r\n        printf, sprintf, scanf, gets, fgets,\r\n        rand, srand, time, clock, gettimeofday,\r\n        system, fork, exec, exit,\r\n        va_start, va_arg, va_end,\r\n        cin, cout, cerr, delete, new\r\n2. Switch statements cannot have implicit fallthroughs (use break or [[fallthrough]])\r\n3. Switch statements must have default statements\r\n4. No continue statements\r\n5. No uncontrolled jump statements, including goto\r\n6. No function like macros\r\n\r\n### Python Rules  \r\n1. Code must follow PEP8 standards (flake8 used for PEP8 compliance checking).\r\n2. All variables must be declared with static type hints.\r\n  > x : int = 5\r\n3. All functions must have a return annotation.  \r\n> def func() -> int:\r\n4. All function parameters must have static type hints.\r\n> def func(x:int) -> int:\r\n5. Certain inherently unsafe python functions (with regards to external code execution) are banned. The current list is:\r\n> eval, exec, pickles\r\n6. Threads used from python threading module must be joined.\r\n7. Subprocesses must have a termination, wait, or communicate call to prevent zombie processes.\r\n\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RoLint - A multi-language linter for safe robotic software development (C, C++, Python)",
    "version": "0.1.10",
    "project_urls": null,
    "split_keywords": [
        "linter",
        " robotics",
        " static-analysis",
        " c",
        " cpp",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "762758251d72a8d734167cf3f16ada596dba56bd244abfbef241cb176e7fa153",
                "md5": "3c59c2ab48a3cf9012a317a95f462acc",
                "sha256": "5d117eb72e776a8537b95b952405d0b37f545e16bd2806bab90096104a444ce4"
            },
            "downloads": -1,
            "filename": "rolint-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c59c2ab48a3cf9012a317a95f462acc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 28317,
            "upload_time": "2025-09-13T14:13:16",
            "upload_time_iso_8601": "2025-09-13T14:13:16.929767Z",
            "url": "https://files.pythonhosted.org/packages/76/27/58251d72a8d734167cf3f16ada596dba56bd244abfbef241cb176e7fa153/rolint-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "53082d670e8190d2d66e18b471c6fa3f8ffbbbba14c9e3ce9eb0c4b95894a451",
                "md5": "f7ce51a80196b9e8ded41da6e6fb198c",
                "sha256": "0bf99a0ebcd893faa8d01882b5b7a0a72fb6e24eb94368d82e8afb6c1123ba15"
            },
            "downloads": -1,
            "filename": "rolint-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f7ce51a80196b9e8ded41da6e6fb198c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 24813,
            "upload_time": "2025-09-13T14:13:18",
            "upload_time_iso_8601": "2025-09-13T14:13:18.091380Z",
            "url": "https://files.pythonhosted.org/packages/53/08/2d670e8190d2d66e18b471c6fa3f8ffbbbba14c9e3ce9eb0c4b95894a451/rolint-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-13 14:13:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "rolint"
}
        
Elapsed time: 2.12610s