lint

JSLint: control comments (selective ignore)

白昼怎懂夜的黑 提交于 2019-11-27 07:23:25
Does JSLint have anything like JavaScript Lint's control comments (e.g. /*jsl:fallthru*/ ) to make it ignore certain passages? napoleonss Put /*ignore jslint start*/ before and /*ignore jslint end*/ after the code to be ignored. Ex: function ignore(){ /*ignore jslint start*/ var x; var y; /*ignore jslint end*/ } Or export JsLint settings, define your IgnoreErrorStart/ IgnoreErrorEnd symbols and import. Edit Some folks may confuse this answer with JSHint. In that case, use these: /*jshint ignore:start*/ <!-- code in here --> /*jshint ignore:end*/ Taken from https://stackoverflow.com/a/26012357

JSHint and jQuery: '$' is not defined

一世执手 提交于 2019-11-27 04:57:19
问题 The following JS: (function() { "use strict"; $("#target").click(function(){ console.log("clicked"); }); }()); Yields: test.js: line 5, col 3, '$' is not defined. When linted using JSHint 0.5.5. Any ideas? 回答1: If you are using a relatively recent version of JSHint, the generally preferred approach is to create a .jshintrc file in the root of your project, and put this config in it: { "globals": { "$": false } } This declares to JSHint that $ is a global variable, and the false indicates that

Android Studio's “expected resource of type” checks?

廉价感情. 提交于 2019-11-27 04:20:54
问题 Android Studio Beta (0.8) has a nifty new feature where it checks that some int parameters are not arbitrary integers, but rather have some properties. For example, calling something like: setContentView(R.id.textView1); will correctly report that R.id.textView1 is not a layout id (the message is "expected resource of type layout"). There are other cases of this peppered around. Understandably, this protection is lost as soon as you add your own methods into the mix, e.g. private void

in c: func(void) vs. func() [duplicate]

ⅰ亾dé卋堺 提交于 2019-11-27 04:15:24
This question already has an answer here: Is it better to use C void arguments “void foo(void)” or not “void foo()”? [duplicate] 6 answers When a C function does not accept any arguments, does it have to be declared/defined with a "void" parameter by the language rules? PC-Lint seems to have problems when there's nothing at all in the argument-list, and I was wondering if it's something in the language syntax that I don't know about. Edit: I just found a duplicate (back-dupe? it came first) question, C void arguments , which has more answers and explanations. void means the function does not

Turning off eslint rule for a specific file

匆匆过客 提交于 2019-11-27 04:10:04
问题 Is it possible to turn off the eslint rule for the whole file? Something such as: // eslint-disable-file no-use-before-define (Analogous to eslint-disable-line.) It happens to me quite often, that in a certain file, I'm breaking a specific rule on many places which is considered OK for that file, but I don't want to disable the rule for the whole project nor do I want to disable other rules for that specific file. 回答1: You can turn off/change a particular rule for a file by putting the

Ignoring return values in C

寵の児 提交于 2019-11-27 01:44:59
问题 Lately, I started using lint for static code analysis. One of the warning I get sometimes is regarding this issue. Let's say for instance that I've got the following function: uint32_t foo( void ); And let's say that I delibertly ignore the return value of the function. To make the warning dissapear, one can write (void) foo(); My question is, what is the "proper" way to write code like this, should I continue as I always did, since the compiler doesn't complain about it, or should I use the

SyntaxError: unexpected EOF while parsing

江枫思渺然 提交于 2019-11-26 22:46:04
问题 I am getting error while running this part of the code. tried some of the existing solutions, none of them helped elec_and_weather = pd.read_csv(r'C:\HOUR.csv', parse_dates=True,index_col=0) # Add historic DEMAND to each X vector for i in range(0,24): elec_and_weather[i] = np.zeros(len(elec_and_weather['DEMAND'])) elec_and_weather[i][elec_and_weather.index.hour==i] = 1 # Set number of hours prediction is in advance n_hours_advance = 24 # Set number of historic hours used n_hours_window = 24

Compiler warning for function defined without prototype in scope?

白昼怎懂夜的黑 提交于 2019-11-26 22:05:18
问题 [Question inspired by a comment thread at this answer.] As everyone knows, since C99 it's an error to call a function that hasn't been declared, preferably with a proper prototype. But, going beyond that, I want my compiler to warn me if I define a function without a prototype declaration in scope, presumably included out of the same header file that the callers are using. (Unless the function is static, in which case all of this is moot.) The reason should be obvious: If there's a prototype

What exactly does Android's @hide annotation do?

北战南征 提交于 2019-11-26 16:44:51
问题 Lots of internal APIs in Android are marked @hide . What exactly does this do? Another answer says that it only hides the methods from Javadoc, but that you can use reflection to access them. That makes no sense though - if they are only hidden from Javadoc then you surely wouldn't need reflection to access them. In fact I've found that I don't. I can still call some @hide methods (maybe just static ones?) and the app compiles and runs fine as far as I can tell. I just get a lint error: Note

How to add -Xlint:unchecked to my Android Gradle based project?

一个人想着一个人 提交于 2019-11-26 15:03:31
问题 I tried to add the following to the root build.gradle file: subprojects { gradle.projectsEvaluated { tasks.withType(Compile) { options.compilerArgs << "-Xlint:unchecked -Xlint:deprecation" } } } But I'm getting this: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':Libraries:ActionBarSherlock:compileRelease'. > invalid flag: -Xlint:unchecked -Xlint:deprecation What am I doing wrong? 回答1: This is what worked for me: (in your project's build.gradle)