Skip to content

bast/localimporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Locates sources which might require an include reorder.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages