lint

Are there any lint tools for C and C++ that check formatting?

亡梦爱人 提交于 2019-12-03 02:08:32
I have a codebase that is touched by many people. While most people make an effort to keep the code nicely formatted (e.g. consistent indentation and use of braces), some don't, and even those that do can't always do it because we all use different editors, so settings like spaces vs. tabs are different. Is there any standard lint tool that checks that code is properly formatted, but doesn't actually change it (like indent but that returns only errors and warnings)? While this question could be answered generally, my focus is on C and C++, because that's what this project is written in. Nikola

Conflicting lint messages regarding paddingStart usage

不羁的心 提交于 2019-12-03 00:59:15
After API 17 / RTL support was released, I added the following to my manifest android:supportsRtl="true" which caused Lint to rightfully give me these warnings wherever I had paddingLeft/Right in my views: Consider adding android:paddingStart="8dp" to better support right-to-left layouts Consider adding android:paddingEnd="8dp" to better support right-to-left layouts I did this following the guidance found in this android-developers blogpost , which implied that we did not need to create a new layout-v17 file, but rather could just use both the paddingStart/End as well as the paddingLeft/Right

how to avoid “Octal literals are not allowed in strict mode” with createWriteStream

北战南征 提交于 2019-12-02 20:04:57
I have the following code fs.createWriteStream( fileName, { flags : 'a', encoding : 'utf8', mode : 0644 }); I get a lint error Octal literals are not allowed in strict mode. What is the correct way to do this code so I won't get a lint error? I don't have a node installation at hand, but looking at sources it seems that they allow strings as well: mode : '0644' Does it work? You can write them like this : mode : parseInt('0644',8) In node and in modern browsers (see compatibility ), you can use octal literals: mode : 0o644 I came through this problem while using it in a scape squence: console

How to recompile with -Xlint:deprecation

岁酱吖の 提交于 2019-12-02 17:57:23
I don't use Android Studio but I build everything from the command line using build.gradle . I generate a Lint report like this: ./gradlew lint This correctly generates a Lint report but it also says this: Note: MyActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. This makes me wonder how I can do that? I've tried the following: ./gradlew lint -Xlint:deprecation But it doesn't work. It says: Problem configuring task :app:lint from command line. Unknown command-line option '-X'. So how can I pass -Xlint:deprecation to Lint via gradle? Andreas

How to configure package.json to run eslint script

不问归期 提交于 2019-12-02 17:53:36
So I am using eslint as a linter for my react project and I would like it to check all of my .js files. I am able to do this through the script: "lint": "eslint back/*.js && eslint backTest/*.js && eslint front/actions/*.js" how can I get it to examine every .js file recursively, something like: "lint": "eslint -r *.js" This would save me having to type out each file inidvidually Thanks in advance for the help eslint "**/*.js" to run on all js files in all the folders recursively (in the current folder) You can also do: AnyFolder/**/*.js And to ignore a folder: eslint "**/*.js" --ignore

VS Code formatting for “{ }”

不问归期 提交于 2019-12-02 17:06:08
I'm on ubuntu. When I write C++ code in VS Code it automatically lints like if (condition == true) { DoStuff(); } instead I want to do like if (condition == true) { DoStuff(); } How do I do that? I've already installed C/C++ extension from marketplace. base on @Chris Drew's answer Go Preferences -> Settings Search for C_Cpp.clang_format_fallbackStyle Click Edit, Copy to Settings Change from "Visual Studio" to "{ BasedOnStyle: Google, IndentWidth: 4 }" e.g. "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}" btw ColumnLimit: 0 is helpful too, because

Lint warning for bad performance - 80+ Views

廉价感情. 提交于 2019-12-02 10:22:16
I am getting this lint warning error: highscores.xml has more than 80 views bad for performance . This is my high scores table that has 15 rows and 3 columns. This is the Lite version of my app and my paid version is going to hold 30 rows. My question is how can I optimize this code? There has to be a better way. highscores.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/relativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="*" android

Ignoring library project with Android lint on the command line

匆匆过客 提交于 2019-12-01 18:23:03
I am using Android lint with Jenkins and need to ignore library projects (specifically Action Bar Sherlock) that my team does not modify so that we can get useful results from Android lint. At the moment I am launching lint from the command line and saving the results to an XML file that can then be read by Jenkins. What I can't seem to do though is ignore library projects. In Eclipse you can explicitly disable scanning of library projects but I can't figure out if there is a corresponding command line argument for this. I have come up with a few different work-arounds for this issue but none

Android lint on command-line missing issue groups (versus options available in Android Studio)

淺唱寂寞╮ 提交于 2019-12-01 09:31:51
When I run lint in Android Studio via Analyze -> Inspect Code I am able to select from a large variety of things to look for. When I go to the command-line version of lint and list all available things to check (lint --list), I get a list that does not include all the inspections I see in Android Studio. For example, I am able to run an inspection with ID ConstantConditions in Android Studio, but am unable to run it on the command-line. ~/app [master] lint --check ConstantConditions --xml results.xml app Invalid id or category "ConstantConditions". Is Android Studio using some other version of

Android lint on command-line missing issue groups (versus options available in Android Studio)

社会主义新天地 提交于 2019-12-01 09:03:01
问题 When I run lint in Android Studio via Analyze -> Inspect Code I am able to select from a large variety of things to look for. When I go to the command-line version of lint and list all available things to check (lint --list), I get a list that does not include all the inspections I see in Android Studio. For example, I am able to run an inspection with ID ConstantConditions in Android Studio, but am unable to run it on the command-line. ~/app [master] lint --check ConstantConditions --xml