https://github.com/bast/localimporter
Locates sources which might require an include reorder.
https://github.com/bast/localimporter
c cpp header-files includes
Last synced: 13 days ago
JSON representation
Locates sources which might require an include reorder.
- Host: GitHub
- URL: https://github.com/bast/localimporter
- Owner: bast
- License: mpl-2.0
- Created: 2018-05-05T11:27:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-05T11:34:48.000Z (almost 8 years ago)
- Last Synced: 2026-01-24T12:43:45.510Z (3 months ago)
- Topics: c, cpp, header-files, includes
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](LICENSE)
# localimporter: locates sources which might require an include reorder
Script that goes through your C/C++ project and finds sources which include
standard headers before including local headers.
You may then consider reordering these.
Why? Because importing standard headers first may mask missing imports in your
own local headers and sources and they otherwise may stop compiling if the
order changes or if somebody uses them in another code.
The script does not modify any files.
## Example
```
$ python localimporter.py --root /home/user/exciting-project
/home/user/exciting-project/src/this.hpp
/home/user/exciting-project/src/that.h
/home/user/exciting-project/src/another.cpp
/home/user/exciting-project/src/somelib.c
/home/user/exciting-project/src/main.cpp
$ python localimporter.py --root /home/user/exciting-project --suffixes "['hpp']"
/home/user/exciting-project/src/this.hpp
```
## Command line options
```
$ python localimporter.py --help
Usage: localimporter.py [OPTIONS]
Options:
--root TEXT Directory root under which the script will search files.
--suffixes TEXT List of suffixes to search, default: ['h', 'hpp', 'c',
'cpp'].
--help Show this message and exit.
```