{"id":13673692,"url":"https://github.com/mapbox/cncc","last_synced_at":"2025-04-28T11:30:38.455Z","repository":{"id":36212210,"uuid":"40516481","full_name":"mapbox/cncc","owner":"mapbox","description":"Customizable Naming Convention Checker - uses Clang, developed with C++ in mind","archived":false,"fork":false,"pushed_at":"2016-01-04T15:02:50.000Z","size":8,"stargazers_count":127,"open_issues_count":4,"forks_count":10,"subscribers_count":120,"default_branch":"master","last_synced_at":"2025-04-18T08:00:41.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-11T02:17:15.000Z","updated_at":"2024-12-03T07:28:19.000Z","dependencies_parsed_at":"2022-09-04T03:51:27.738Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/cncc","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/mapbox%2Fcncc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcncc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcncc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcncc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/cncc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251304664,"owners_count":21567918,"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-08-02T11:00:16.543Z","updated_at":"2025-04-28T11:30:38.157Z","avatar_url":"https://github.com/mapbox.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["LibClang"],"readme":"# Customizable Naming Convention Checker\n\nCNCC is a customizable naming conventions checker for C++.\nIn using the Clang frontend CNCC works directly on the language's abstract syntax tree (AST).\nThis is quite similar to what `clang-format` does but way more simple and for naming conventions only.\n\nIn short, CNCC supports user-defined pattern validation based on AST nodes: you can specify patterns for variables, class names, namespace names, and so on.\n\nNote: [recent this patch](https://github.com/llvm-mirror/clang-tools-extra/commit/89b8288d86c6b9cbe2526e8b78b8c3559a34e7e4) introduces the concept to `clang-tidy.`\n\n## Example\n\nYou provide a style file containing regular expressions for validating AST nodes, such as:\ncamel-case for class names, members should have an underscore appended, and so on.\n\n```\nclass_decl: '^([A-Z][a-z]+)+$'\nfield_decl: '^[a-z]+_$'\nvar_decl: '^[a-z][a-z0-9]*$'\nnamespace: '^[a-z]?$'\n```\n\nCNCC then checks the AST's nodes against the provided rules, issuing warnings to `stderr` and returning with a appropriate status code for easy integration:\n\n    test.cc:4:11: \"myNamespace\" does not conform to pattern \"^[a-z]?$\" associated with namespace\n    test.cc:6:7: \"myClass\" does not conform to pattern \"^([A-Z][a-z]+)+$\" associated with class_decl\n    test.cc:11:9: \"myMember\" does not conform to pattern \"^[a-z]+_$\" associated with field_decl\n    test.cc:19:24: \"myMember\" does not conform to pattern \"^[a-z]+_$\" associated with field_decl\n\nFor all available nodes see the [official libclang documentation](http://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013) or the [Python wrapper documentation](https://github.com/llvm-mirror/clang/blob/aca4fe314a55cacae29e1548cb7bfd2119c6df4c/bindings/python/clang/cindex.py#L599) and look for `CursorKind`.\n\n## Requirements\n\n* python2\n* python-clang\n* python-yaml\n\n## Usage\n\nFor standalone files, with default compiler invocation:\n\n    cncc --style=examples/small.style examples/test.cc\n\nCNCC defaults to reading a `.cncc.style` file in your home directory if no style file was given.\n\n    cncc examples/test.cc\n\nSometimes compilation gets more involved.\nUse CMake or Bear in order to create a `compile_command.json` compilation database.\nIn it compiler invocation flags and arguments are stored for each file involved in the build process.\nThis does not require you to build your program.\n\n    mkdir build\n    cd build\n    ccmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1\n    cncc --style=~/.cncc.style --dbdir . ../main.cc\n\n## License\n\nCopyright © 2015 Daniel J. Hofmann\n\nDistributed under the MIT License (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fcncc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fcncc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fcncc/lists"}