{"id":22850266,"url":"https://github.com/956mb/comment-linter","last_synced_at":"2025-03-31T06:28:44.595Z","repository":{"id":106049488,"uuid":"256130597","full_name":"956MB/comment-linter","owner":"956MB","description":"Comment \"linter\" written in Python. Also C, since I'm trying to learn the language.","archived":false,"fork":false,"pushed_at":"2020-05-13T02:14:01.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T10:53:22.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/956MB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-16T06:38:09.000Z","updated_at":"2020-05-13T02:28:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"ffad0298-ba10-4cae-8923-ecd581dc1b5a","html_url":"https://github.com/956MB/comment-linter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/956MB%2Fcomment-linter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/956MB%2Fcomment-linter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/956MB%2Fcomment-linter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/956MB%2Fcomment-linter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/956MB","download_url":"https://codeload.github.com/956MB/comment-linter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246427894,"owners_count":20775666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T05:07:01.295Z","updated_at":"2025-03-31T06:28:44.570Z","avatar_url":"https://github.com/956MB.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# comment-linter\n\nComment \"linter\" vertically lines up groups of comments inside a file.\n\n_Yes, I'm sure something like this already exists, and is written in a much better way, but oh well. I thought it'd be a cool thing to try._\n\n### How:\n\nComments in a file are first grouped. Groups are made up of comments that are within 1 line space of each other. Next, out of these groups, the furthest to the right comment is picked, as to line up the rest of the comments in a group with it.\n\n\"top level\" comments are when there is nothing but blank spaces before the comment, and these are not counted into groups, and are kept where they are. An example of this could be a comment saying what the function below it does, or a chunk of code that was commmented out. That way the chunks indentation will not be messed up, because all that will be in front of it is blank spaces.\n\n### What it does not do:\n\n- Fix extra or missing spaces inside comments.\n- Horizontally fix comments locations to the tab size in the file.\n    - If the furthest comment in a group is 6 spaces to the right of code, all this will do is line up all other comments in the group to this comment. Not move the comments in to the current tab size, say 4 spaces. Maybe this can be done pretty easily, idk.\n\nBefore:\n\n```c++\nint main(void) {\n    unsigned long i;\n    unsigned char display = 0;\n\n    // initialization                                       \u003c\u003c \"top level\" comment with all blank spaces does not get grouped\n    PORTA = 0x000;  // clear port A                         \u003c\u003c\n    TRISA = 0xFF00;     // set PORTA \u003c7:0\u003e to output        \u003c\u003c Comments seperated by 0 or 1 line spaces are grouped\n    TRISD = 0xFFFF;     // set PORTD to input               \u003c\u003c\n\n    // ...                                                  \u003c\u003c 2 or more line spaces split up the groups\n\n    // endless loop\n    while(1) {\n        Nop();          // breakpoint access point\n        PORTA = (unsigned int) display; // sent count to display\n        for(i = 1001L*SCALE;i \u003e 0; i--)Nop();      // delay start with 0\n        if(PORTDbits.RD13==0)\n            display=display+1;          // if S4 pressed increment display counter\n        else if(PORTDbits.RD6 == 0)\n            display = 0;   // else if S3 pressed reset display counter\n        else\n            display = display-1;        // else decrement display counter\n    }\n```\n\nAfter:\n\n```c++\nint main(void) {\n    unsigned long i;\n    unsigned char display = 0;\n\n    // initialization\n    PORTA = 0x000;      // clear port A\n    TRISA = 0xFF00;     // set PORTA \u003c7:0\u003e to output\n    TRISD = 0xFFFF;     // set PORTD to input\n\n    // endless loop\n    while(1) {\n        Nop();                                     // breakpoint access point\n        PORTA = (unsigned int) display;            // sent count to display\n        for(i = 1001L*SCALE;i \u003e 0; i--)Nop();      // delay start with 0\n        if(PORTDbits.RD13==0)\n            display=display+1;                     // if S4 pressed increment display counter\n        else if(PORTDbits.RD6 == 0)\n            display = 0;                           // else if S3 pressed reset display counter\n        else\n            display = display-1;                   // else decrement display counter\n    }\n}\n```\n\n# USAGE:\n\nNormal files (.c, .py, .js, etc.):\n\n```\n$ ./linter.py -i \"file.c\"                   \u003c\u003c Overwrite with linted file\n\n$ ./linter.py -i \"file.c\" -o \"newfile.c\"    \u003c\u003c New file with '-o/--output'\n```\n\nPlain text files:\n\n```\n$ ./linter.py -i \"README\" -s \"//\"           \u003c\u003c '-s/--symbol' for the \"comments\" symbol in the plain text file\n```\n\n# TODO:\n\n* Rewrite in JavaScript/TypeScript for use in VSCode as an extension.\n* Include line selection to use on specific chunk of code rather than entire file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F956mb%2Fcomment-linter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F956mb%2Fcomment-linter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F956mb%2Fcomment-linter/lists"}