CheckStyle comments - ide

In Idea I turn options "Comment at first column"
CheckStyle throws an error
How to solve it
Comment has incorrect indentation level 0, expected is 10, indentation should be the same level as line 139. [CommentsIndentation]
EDIT 28.06.2019
checkstyle.xml
Idea Preference
If block
148: CompletableFuture.allOf(terminateEnvironmentResponseCompletableFuture, checkInvoicePaidResponseCompletableFuture,
149: inactiveUserResponseCompletableFuture).whenComplete((v, th) -> {
151: if (th != null) {
152: log.error(th.getMessage(), th);
153: }
154: finishDelete(userDto);
155: });
Errors:
....java:150: 'if' has incorrect indentation level 14, expected level should be 18. [Indentation]
....java:151: 'if' child has incorrect indentation level 16, expected level should be 20. [Indentation]
....java:152: 'if rcurly' has incorrect indentation level 14, expected level should be 18. [Indentation]
....java:153: 'block' child has incorrect indentation level 14, expected level should be 18. [Indentation]
....java:154: 'block rcurly' has in*correct indentation level 12, expected level should be 16. [Indentation]
Comments
108: .withIdentity("ServicesTrigger", "TriggerGroup")
109:// is fired every day at 3:00 am
110: .withSchedule(cronSchedule("0 0 3 * * ?"))
111:// .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(12).repeatForever())
112: .forJob(_servicesJob)
113: .build();
114: _scheduler.scheduleJob(_servicesJob, serviceTrigger);
Errors:
....java:110: Comment has incorrect indentation level 0, expected is 10, indentation should be the same level as line 111. [CommentsIndentation]
....java:112: Comment has incorrect indentation level 0, expected is 10, indentation should be the same level as line 113. [CommentsIndentation]

In Idea I turn options "Comment at first column"
CheckStyle throws an error How to solve it
CommentsIndentation doesn't currently support comments being required at the first column. The default behavior is comments must be at the same indentation as the surrounding code.
If you want to see that kind of behavior from CommentsIndentation you will need to create an issue at checkstyle on github. For now, I recommend disabling the check. Either remove it from the configuration or comment it out.

You can put comment slashes "//" right on front of commenting line text. That can fix your problem.
Your example:
108: .withIdentity("ServicesTrigger", "TriggerGroup")
109: //is fired every day at 3:00 am
110: .withSchedule(cronSchedule("0 0 3 * * ?"))
111: //.withSchedule(SimpleScheduleBuilder. etc...

Related

Escape lower than (lt) greater than (gt) operators text version Velocity Template Languaga

I have the following statement in my vtl on line 36 :
#if( !$util.isNullOrEmpty($ctx.args.filter.outstanding_amount.lt))
I get an error:
Parse error on line 36:
....outstanding_amount.lt)) $util.qui
-----------------------^
Expecting 'ID', 'CONTENT', got '<'
I read that lt and gt are a short versions of lower than and greater than operators.
How to make the parser understand .lt and .gt as identifiers and not logical operators?
Try:
$ctx.args.filter.outstanding_amount.get('lt')

BQ Error: references position X, but line starting at position:_contains only X columns

I am well aware of what a good question on SO looks like, and I'm sorry I cannot share the data generating the error, so yes this is a bad question. I am however getting an extremely cryptic error message:
'Error while reading data, error message: CSV table references column position 42, but line starting at position:636 contains only 42 columns.'}, 'errors': [{'reason': 'invalid', 'location': 'XXXX', 'message': 'Error while reading data, error message: CSV table references column position 42, but line starting at position:636 contains only 42 columns.'}, {'reason': 'invalid', 'message': 'Error while reading data, error message: CSV processing encountered too many errors, giving up. Rows: 6285; errors: 1; max bad: 0; error percent: 0'}], 'state': 'DONE'}}
The error message seems to say that a particular row of mine has 42 columns BUT the table (I've predefined the schema not auto-generated) expects 42... which doesn't make sense. Any insight into what is occurring? I looked at row 6285 and nothing looks incorrect to me. I don't know what position 636 means? Row 6285 doesn't even have 500 characters on it. Maybe that's the problem? Something to do with bad newlines or something?
"Position" in the BigQuery CSV import errors refer to byte offsets from the start of the file. Therefore "line starting at position:636" refers to the line starting 636 bytes from the beginning of the file.
Regarding the error message itself: references column position 42, but line starting at position:636 contains only 42 columns. This is saying that the schema expects a column "42" (zero indexed?) but there aren't enough columns at this line.
If this is expected, you may consider enabling the --allow_jagged_rows option, which will treat missing columns at the end of a row as NULL instead of error.

Oracle - PLS-00103: Encountered the symbol "END" when try to create JOB

i have a problem here,
i already have a Stored Procedure called "SP_DEL_TOKEN"
and i wanna make a job to run the Stored procedure automatically everyday..
this is my script to make the job
VAR jobno NUMBER;
BEGIN
DBMS_JOB.SUBMIT(:jobno, 'SP_DEL_TOKEN', SYSDATE, 'SYSDATE+1');
COMMIT;
END;
/
but when i do that script, i encountered with this error
ERROR at line 1:
ORA-06550: line 1, column 106:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
:= . ( # % ;
The symbol ";" was substituted for "END" to continue.
ORA-06512: at "SYS.DBMS_JOB", line 79
ORA-06512: at "SYS.DBMS_JOB", line 136
ORA-06512: at line 2
please help me,
and thanks for helping me :)
You need a semicolon at the end of the "what" parameter. Use 'SP_DEL_TOKEN;' instead of 'SP_DEL_TOKEN'. See the manual for some more examples.
I'm not sure why this is. With dynamic SQL you cannot have a semicolon, and with dynamic PL/SQL you need the BEGIN and END;. I guess this parameter is used in some weird context.

How are error messages in StringTemplate to be interpreted?

I got this error message while using StringTemplate:
line 94:26: unexpected char: ')'
And after about 15 minutes of randomly adding and removing blank lines in my template, and observing how the number in that message changed, I finally isolated the line that caused trouble. It was line #152, position #35.
Is the value after "line " just normally totally wrong, or is there a way of deducing the real line number from that output?
In StringTemplate (ST) 4, it appears that the first number is the line number, within the specific template at issue and not the line number within the .stg file if that's what you're using (which most of us do).
When I'm using vim, this means I need to mentally offset that from the line number of the first line of the template (add them together) to get the actual line number within the .stg file.
The second number in the ST error is the character position within that line of the template. But wait, there's more - you know you love it...
When an error is on the first line of a multi-line template: since ST elides the starting newline in multi-line templates, ST effectively combines the first/ declaration line (ending in "<<") with the second (actual start of the template) line, in multi-line templates;
so at least with ST-4.0.8 I need to subtract the length of the template declaration line from the character position, to get the actual character position.
The first "\n" eliding (for multi-line templates only) also means the line number may appear to be offset by 1, and possibly the character position, for an error on the "first line".
The error should include the filename and template name, so it's enough information for an automated script or tool, but a bit cumbersome for us mere humans.
Good luck.

Is there a way to use block comments after a GO in SQL?

I have an auto-generated SQL script with this basic structure:
/*
*/
PRINT 'Stuff'
GO
/*
*/
PRINT 'Other stuff'
The problem is that SQL Server doesn't seem to like block comments when they are placed after a GO. There is a bug for this on Connect (set to won't-fix, sigh) and a guy named Devi posted some workarounds, but they don't really work for me because my script is auto-generated.
I can insert something after the GO and before the second block comment. I've tried various things in there, however, without changing the failing outcome which, fwiw, is this helpful text:
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ''.
Is there anything I can stick in between the GO and the comment to avoid this error?
Your issue seems to be of a different nature, and two things point to that.
The linked Connect page is about /* ... */ comment after GO on the same line with it, but in your case the comment starts on the line that follows GO.
The issue you are alluding to produces this error message:
A fatal scripting error occurred.
Incorrect syntax was encountered while parsing GO.
But yours is different:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ''.
I'm going to guess here (but not unreasonably, I hope) that your script generator uses Mac style line breaks (0x0D) instead of Windows style ones (0x0D0A). I was able to almost reproduce the issue using Mac line breaks, but in my case the error was just a little bit different from yours:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'GO'.
Still it seems close enough for me to suggest you check what kind of line breaks your script generator uses.