Flint++Flint++ is cross-platform, zero-dependency port of flint, a lint program for C++ developed and used at Facebook.
This project was motivated by a desire for a modern and extendable C++ Linter that just worked. Facebook had already done a fantastic job with their flint project; but through an unnecessarily high number of dependencies, poor documentation, and OS-dependent coding, the project was almost unusable. Flint++ aims to solve these problems by only using the C++11 std::library along with a minimal number of functions developed to bridge the gaps in the needed functionality.
The original flint is published on Github; and for discussions, there is a Google group.
@AaronDMarasco forked from the @kanielc fork of the @JossWhittle fork in 2020 (with no activity since 2014). Cleaned up a little, manually merged in the following forks (closing all JossWhittle PRs that were open at the time), added RPM building and CI abilities, and now it's "as-is":
Linting is a form of static-code analysis by which common errors and bad practices are flagged for review. This can help to both optimize poorly written code and to set a unified code style for all the code in a project. For large organizations this can be tremendously powerful as it helps to keep the whole codebase consistent.
#if ... #endif Balancememset Usagemutex holdersexplicit single argument constructorstry-catch by referencethrow new ...unique_ptr arrays#define name rules#includesstatic scopesmart_ptr usageimplicit castsprotected inheritanceexception inheritancevirtual destructorsthrowsnullptr over NULL$ flint++ --help
Usage: flint++ [options:] [files:]
-r, --recursive : Search subfolders for files.
-c, --cmode : Only perform C based lint checks.
-j, --json : Output report in JSON format.
-v, --verbose : Print full file paths.
-l, --level [def = 3] : Set the lint level.
1 : Errors only
2 : Errors & Warnings
3 : All feedback
-h, --help : Print usage.
Flint++ from sourceFrom the flint subdirectory, use make with the included Makefile to build. To run the simple output test cases, run make check after compilation. This will run Flint++ on the test directory and compare its output to the text stored in tests/expected.txt.
Additional information can be found by examining .travis.yml.
All good.
$ flint++ ./ Checks/ AdvancedChecks/ # NOT -r or test cases included
Lint Summary: 37 files
Errors: 0 Warnings: 0 Advice: 0
Estimated Lines of Code: 3953
make will use your system-default compiler and C++ library. On GCC-based systems, you can explicitly force clang (and libc++) by calling CXX=clang++ make -j. This may fail and may require additional packages, e.g. libcxx-devel on Fedora or libc++-dev on Ubuntu.
To create a tarball of the source, make dist at the top-level.
tar so OSX and other BSD systems will need to ensure their $PATH is configured properly!An RPM package can be built by calling make rpm at the top-level.
A DEB package can be built by calling make deb at the top-level.
An "official" image is available on Docker Hub.
If you would like to locally build an image, it can be built by calling make docker at the top-level. It will automatically use the docker or podman CLI.
Note: This document uses podman, but every command shown should work using the docker executable with the same options if you are using an older Fedora-based system or a non-Fedora-based Linux distribution.
By default, the image will recursively scan /src within the container; this must be mounted in the proper manner (e.g. SELinux context with :z).
Some examples:
podman run --rm -v $(pwd):/src:z admarasco/flintpodman run --rm -v $(pwd):/src:z flintpodman run --rm -v $(pwd):/src:z flint -j | jq .podman run --rm flint -h.Current maintainer develops with G++ 10.1.1 (Fedora 32) and Travis CI currently tests 10 different configurations using GCC and clang on Linux, MacOS X, and Windows.
Content type
Image
Digest
Size
27.6 MB
Last updated
over 5 years ago
docker pull admarasco/flint