Как установить cpplint ubuntu
Перейти к содержимому

Как установить cpplint ubuntu

  • автор:

Name already in use

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.rst

cpplint — static code checker for C++

Cpplint is a command-line tool to check C/C++ files for style issues following Google’s C++ style guide. Cpplint is developed and maintained by Google Inc. at google/styleguide, also see the wikipedia entry

While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. Also see discussion here google#528.

To install cpplint from PyPI, run:

Then run it with:

For full usage instructions, run:

The modifications in this fork are minor fixes and cosmetic changes, such as:

  • python 3 compatibility
  • more default file extensions
  • customizable file extensions with the —extensions argument
  • continuous integration on github
  • support for recursive file discovery via the —recursive argument
  • support for excluding files via —exclude
  • JUnit XML output format
  • Overriding repository root auto-detection via —repository
  • Support #pragma once as an alternative to header include guards
  • . and a few more (most of which are open PRs on upstream)

Thanks to Google Inc. for open-sourcing their in-house tool. Thanks to maintainers of the fork

cpplint 1.6.1

Cpplint is a command-line tool to check C/C++ files for style issues following Google’s C++ style guide. Cpplint is developed and maintained by Google Inc. at google/styleguide, also see the wikipedia entry

While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. Also see discussion here https://github.com/google/styleguide/pull/528.

Installation

To install cpplint from PyPI, run:

Then run it with:

For full usage instructions, run:

Changes

The modifications in this fork are minor fixes and cosmetic changes, such as:

Acknowledgements

Thanks to Google Inc. for open-sourcing their in-house tool. Thanks to maintainers of the fork

Static code checker for C++

Cpplint is a command-line tool to check C/C++ files for style issues following Google’s C++ style guide. Cpplint is developed and maintained by Google Inc. at google/styleguide, also see the wikipedia entry

While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. Also see discussion here https://github.com/google/styleguide/pull/528.

To install cpplint from PyPI, run:

Then run it with:

For full usage instructions, run:

The modifications in this fork are minor fixes and cosmetic changes, such as:

  • python 3 compatibility
  • more default file extensions
  • customizable file extensions with the —extensions argument
  • continuous integration on travis
  • support for recursive file discovery via the —recursive argument
  • support for excluding files via —exclude
  • JUnit XML output format
  • Overriding repository root auto-detection via —repository
  • Support #pragma once as an alternative to header include guards
  • . and a few more (most of which are open PRs on upstream)

Thanks to Google Inc. for open-sourcing their in-house tool. Thanks to maintainers of the fork

Comments
Move project to cpplint/cpplint

If we move the project to a organisation we can have multiple collaborators on the project and share the maintenance. We use this version of cpplint internally at work and would happily spend time maintaining the project, issues and PRs.

Add language about Unix directory aliases (fixes #139)

Thanks for this great project! cpplint has helped us a lot in LightGBM.

This pull request attempts to address https://github.com/cpplint/cpplint/issues/139#issuecomment-629594423. See the conversation on that issue for background.

Essentially, if something.cpp uses #include "./something.h" , it can generate the warning

src/foo.cpp:2: src/something.cpp should include its header file src/something.h [build/include] [5]

That message might be confusing to people (like me) who didn’t know that Unix directory aliases like ./ are not allowed by the Google style guide.

This PR adds a more informative warning for such cases.

Thanks for your time and consideration!

—exclude not work on Windows with cpplint 1.4.4 Python 3.7.3

I’m trying to use cpplint for code static analysis and here I’m in the trouble with excluded directories 🙁

Long time ago I used a batch script to list all directory and files into a file list and feed cpplint to get the results, but there’s distadvantages that when the files it too many it’ll overflow the max length of command line to work.

I’ve already try to use all the follow code, but none works:

cpplint always lint the very src/third_party directory, please help me, I’m struggling with this issue about several weeks. Hopeless 🙁

cpplint is installed by:

Linux system headers not detected as system headers

PR #133 swapped the dynamic system header detection from <> brackets to a hard coded list of names. This causes false positives in files with Linux specific includes. Unless I’m mistaken and files under /usr/include should not be classified as system headers.

add elif as an exception for CheckSpacingForFunctionCall()

The current version of the code allows for white spaces after preprocessor directive #if (FOO == 1) but not after #elif (FOO == 1) .

The code below will throw this error: test.cpp:4: Extra space before ( in function call [whitespace/parens] [4]

This pull request fixes that.

Update cpplint.py to r456 — rebased

So this is my attempt at fixing the merge conflict in #19. I guess this may break several tests, so there may be several iterations to do. The main conflicts to solve were about the _IsSourceExtension() function and the _test_suffixes variable.

As a sidenote, it would be nicer to keep the git history clean, by fetching commit from the google styleguide and making a merge commit, where the merge result would be something like this PR.

456 — Tweak lint to sometimes allow < on line following array initialization. 455 - Recognize more types. 454 - Try a bit harder to detect templated types. 453 - Changed error message wording on build/storage_class to be less ambiguous. 452 - Recognize more types to silence false positives for brace warnings. 451 - 450 - 449 - Ignore whitespace/tab for Linux Kernel files. 448 - Remove some more false positive lint warnings for int64. 447 — Just one warning message for line length is enough, don’t need two. 446 — Allow braced conversions to int16, uint64, etc. per the style guide. 445 — Fixed handling of backslash escapes for checking whether a "//" is quoted. 444 — Reduced dependency on hardcoded .cc extension. 443 — Disable single-arg constructor checks by default, since ClangTidy has the same check. We could just delete the check entirely, but it’s slightly useful in places that can’t run ClangTidy. 442 — Fix matching of macro names in CheckTrailingSemicolon to include digits. 441 — Deleted checks: — All checks for RValue references. — Spacing check around boolean &&, because those look like RValue references. A huge amount of code and effort were dedicated to tell RValue references apart from boolean expressions, and to differentiate allowed versus banned RValue references. But we still get regular false positives from this one check. Rather than making the check more complex than what it already is, it seemed safer to just delete it altogether for now, and have a different process for catching RValue references. 440 — Add rule to cpplint to throw error on empty if statement bodies without else clauses. If statement bodies with comments are not considered empty. 439 — Allow spaces before closing brace of namespace block so that namespaces inside of macro definitions (where the entire macro definition is indented) are not treated as errors. 438 — cpplint: fix a false positive on new const int(x) . 437 — Only check for function length when current line is inside a function. 436 — cpplint: Catch static std::string instances as well as those written as string . Previously users would sometimes work around the lint warning by changing their code to even worse code by adding the "std::" prefix. 435 — cpplint: Be a little smarter about warning on indentation. 434 — cpplint: Remove false positives on some functions returning string const&. 433 — cpplint: improve diagnostics of global/static string objects. 432 — Allow non-const reference parameters for iostream based types. 431 — Better handling of raw strings inside comments. 430 — 429 — 428 — 427 — Add support to CHECK_NOTNULL when checking if a member variable is initialized with itself. 426 — Allow suppressing specific warnings in C headers. 425 — Allow spaces before parens for inline assembly. 424 — Remove lint checks for _.*_M. 423 — Allow comment lines of more than 80 characters if they contain a single "word" (without any spaces). 422 — cpplint: Warn on inclusion of C++14 headers. 421 — cpplint: recognize <shared_mutex> as a standard library header. 420 — Add <scoped_allocator> to cpplint’s list of C++ standard headers. 419 — Add cpplint check for tr1/ headers. We removed the nanny guards for these 418 — 417 — Update the styleguide and cpplint to allow unnamed parameters 416 — Remove the rule explicitly banning non-default move operations. 415 — Remove the check for explicit multi arg constructors 414 — Include clarity of lambda default captures in "pros" section, mention of capturing this and lambdas which escape the current scope in "cons". Soften the ban on default captures to a preference, with admonition against using them for capturing this or when they will escape the current scope. This is a fairly straightforward change with a brief inclusion of 2 problematic cases for implicit capture. As this is the style guide, I’m not sure how much more detail is appropriate. 413 — Fixed a bug by making regex in CleanseRawStrings match multiple raw strings on a single line in left-to-right order. 412 — Fixed false positive for classes derived using decltype() 411 — 410 — Recognize ‘1LL<<20’ as numeric and don’t flag it for spacing.

Conflicts:

cpplint.py

cpplint_unittest.py

Conflicts:

cpplint.py

cpplint_unittest.py

Fix issue when function arguments with mutiply class or struct keywords

Issue introduction: CPPLint already have protection when function arguments with extra "class" or "struct" keywords, following scenario is fine:

But in case multiply "struct" function arguments existed in a function like below(add "new_struct2" parameter):

It will cause false positive reporting as below: demo.cpp:11: Closing brace should be aligned with beginning of struct demo_struct [whitespace/indent] [3]

Issue analysis: In case meet multiply struct parameters, will push "_ClassInfo" instances mutiply times into the "stack" array of NestingState class , when ";" or ")" token is encountered before OpenBrace is not seen, will pop ONLY one "_ClassInfo" instance from the stack. that makes at least one "struct" parameters be regarded as a "_ClassInfo" block but not a "struct" parameter. Then produce above warning.

Issue reslove: Greedy pop the "_ClassInfo" instance from the stack until "_ClassInfo" instance have open brace when ";" or ")" token is encountered.

in 1.4.1 getting ‘Uncommented text after #endif is non-standard. Use a comment.’

We get a failure on every #endif with 1.4.1 I think the following rege is wrong as it marks a line contianing only ‘#endif’ (with no other characters) as a failure

Please merge with main branch to enable style check on .cu and .cuh files

Is it possible to update the cpplint.py from google (the main branch)? I am mainly looking for the style check feature on cuda source and header files (.cu and .cuh). Will be awesome to see this in the cpplint for pip install.

Running cpplint on Windows 10 cmd.exe results in «failed to create process»

The cpplint console entry point ( cpplint.exe ) does not seem to be working on Windows 10 with Python 3.5.

The same behavior happens outside of a venv .

Handle Other Header Files for Build Include Subdir

build/include_subdir should handle arbitrarily header file extensions.

avoid false positives on transform issue27

This PR addresses https://github.com/cpplint/cpplint/issues/27

I noticed some false positives when using transform in other namespaces. There may be some new false negatives when using namespace std is used and std:: is omitted, but it seems worth it.

using readability/fn_size with configurable parameter of lines

Hi, I would like to set the maximal fn_size to 100 in my project and I already added a filter for readability/fn_size, but I couldn’t find how exactly it can configure the number of lines, is it supported or should I change the code manually?

Add support for NOLINTBEGIN/END

Add support for specifying no lint on multiple lines using a NOLINTBEGIN comment to start the block and one or more NOLINTEND comments. Multiple NOLINTBEGIN comments can stack different categories and the same number NOLINTEND comments need to be used to re-enable the category.

This is similar to the clang-tidy NOLINTBEGIN/END feature.

Also, add support for specifying multiple categories in a single NOLINT comment using commas as separators.

C++20 `[[likely]]` / `[[unlikely]]` attribute support

In C++ attribute: likely , unlikely (since C++20), we can add [[likely]] / [[unlikely]] on if-else clauses. But cpplint does not recognize the [[likely]] / [[unlikely]] attributes after if / else / else if :

#include recognized as C system header

I have the following set of includes in my header file:

If I leave them in this order, then I get the following error message:

Found C system header after C++ system header. Should be: stream_helpers.h, c system, c++ system, other. [build/include_order] [4]

In order to make the linter happy, I need to do this:

If I don’t include the // comment below the #include <span> line, then my clang-format rule reorders the headers alphabetically but then cpplint fails.

Пакет: cpplint (1.5.5-2) [universe]

Please consider filing a bug or asking a question via Launchpad before contacting the maintainer directly.

Original Maintainer (usually from Debian):

  • Wolfgang Silbermayr

It should generally not be necessary for users to contact the original maintainer.

Внешние ресурсы:

Подобные пакеты:

Static code checker for C++

Другие пакеты, относящиеся к cpplint

  • зависимости
  • рекомендации
  • предложения
  • enhances
  • dep: python3 interactive high-level object-oriented language (default python3 version)

Загрузка cpplint

Загрузить для всех доступных архитектур

Архитектура Размер пакета В установленном виде Файлы
all 71,4 Кб 292,0 Кб [список файлов]

This page is also available in the following languages:

Авторские права © 2023 Canonical Ltd.; См. условия лицензии. Ubuntu это торговый знак компании Canonical Ltd. Об этом сайте.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *