Questions tagged [syntax-checking]

Syntax checking is the verification that a program's source code is technically correct according to the rules of that programming language.

110 questions
464
votes
9 answers

How can I check the syntax of Python script without executing it?

I used to use perl -c programfile to check the syntax of a Perl program and then exit without executing it. Is there an equivalent way to do this for a Python script?
Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378
119
votes
4 answers

Compile (but do not run) a Python script

I want to check a script for syntax errors. In both 2.x and 3.x, how can I compile the script without running it?
asmeurer
  • 86,894
  • 26
  • 169
  • 240
33
votes
6 answers

PHP Syntax checking pre-source control

Referring to Is there a static code analyzer [like Lint] for PHP files? -- I am looking at how to assess the content of PHP files before they are committed by developers. Whichever solution(s) are appropriate will be triggered via SVN hooks similar…
sdolgy
  • 6,963
  • 3
  • 41
  • 61
33
votes
4 answers

How to check TypeScript code for syntax errors from a command line?

I have a code that generates TypeScript classes, and as a build/test step, I would like to check the generated files for syntax correctness. I have looked at TypeScript compiler options but see no such option. How can I check the syntax? I don't…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
25
votes
7 answers

How to write a linter?

In my day job I, and others on my team write a lot of hardware models in Verilog-AMS, a language supported primarily by commercial vendors and a few opensource simulator projects. One thing that would make supporting each others code more helpful…
jbdavid
  • 602
  • 1
  • 7
  • 9
23
votes
5 answers

How can I check (My)SQL statements for syntactical correctness

we're currently setting up out integration server and during that process we've set up pre-commit hooks on the SVN so that our developers can't check in files that are syntactically invalid (primarily PHP and XML). We also have a bunch of .sql files…
n3rd
  • 5,989
  • 4
  • 39
  • 56
21
votes
8 answers

Online PHP syntax checker / validator

Could someone refer me to an online PHP validator? It would be of much help. Thanks in advance!
Web_Designer
  • 72,308
  • 93
  • 206
  • 262
20
votes
5 answers

How to check syntax of ruby script that has script/runner as a shebang?

I have problems to check syntax of ruby scripts that has rails script/runner on its shebang. Here are two example scripts and how they responses to ruby syntax checking: Script hello_world_runner.rb: #!/usr/bin/env script/runner p "Hello…
Joni
  • 3,327
  • 3
  • 25
  • 22
17
votes
2 answers

Can't get "Syntastic" vim plugin to work

I've installed Syntastic plugin in vim. I can't get it to work. I've tried :SyntasticEnable but no luck. SyntasticEnable python in my vimrc doesn't work either (in fact, it doesn't even parse the command, an error is shown when I try to add it to my…
15
votes
2 answers

javascript syntax check for Internet Explorer

Is there some tool that can syntax-check my JavaScript files to see if they contain syntax errors that would bother the Javascript engine of Internet Explorer, especially excess trailing commas? Example: var some_object = { valid : "property", …
Udo G
  • 12,572
  • 13
  • 56
  • 89
15
votes
5 answers

Syntax Checking in Java

I am currently working on a program that has an embedded text editor. The users are supposed to type java code in the editor. The code typed into the editor is then made into a string. I just want something that would check for missing parenthesis…
Steven Morad
  • 2,511
  • 3
  • 19
  • 25
14
votes
4 answers

Sublime Text 3 - Disable Python Checker warning "indentation contains tabs"

I didn't find an answer to this question on the web, so I'll say it up front; this is NOT a question about SublimeLinter, and I do NOT want to format my python code according to the PEP8 standards. How to disable the warning "Indentation contains…
Jonathan H
  • 7,591
  • 5
  • 47
  • 80
12
votes
5 answers

Is it possible to check PHP file syntax from PHP?

I load dynamically PHP class files with autoload. And those files could be missing or corrupted by some reason. Autoload will successfully report missing files so application logic could handle that. But if those files are corrupted, then the whole…
Oleksandr Yanovets
  • 4,661
  • 4
  • 31
  • 26
11
votes
2 answers

Syntastic + Django

I just started developing on Django, and then I thought using the Syntastic syntax checker on it would be a good idea. The problem is that it complains about some things being wrong when, in fact, they aren't. Examples: For from…
Falassion
  • 711
  • 1
  • 7
  • 17
10
votes
9 answers

Parentheses pairing ({}[]()<>) issue

I want to be able to pair up all parentheses in a string, if they aren't paired then then they get their index number and False. It seems like it is repeating some values over and over, i.e cl == pop[1]. I have tried to see where the problem is but…
thabubble
  • 640
  • 1
  • 8
  • 17
1
2 3 4 5 6 7 8