Skip to content
Snippets Groups Projects
Commit 1047212f authored by Dominique Marcadet's avatar Dominique Marcadet
Browse files

Merge branch '10-add-warning-level-option-on-the-command-line' into 'master'

Resolve "add warning level option on the command line"

Closes #10

See merge request RiseClipseGroup/RiseClipseValidator_SCL2003!10
parents e229d67d 0d5bd596
No related branches found
No related tags found
1 merge request!10Resolve "add warning level option on the command line"
Pipeline #1257 passed
...@@ -57,12 +57,12 @@ public class RiseClipseValidatorSCL { ...@@ -57,12 +57,12 @@ public class RiseClipseValidatorSCL {
private static boolean oclValidation = false; private static boolean oclValidation = false;
private static boolean nsdValidation = false; private static boolean nsdValidation = false;
@NonNull private static final IRiseClipseConsole console = new TextRiseClipseConsole(); @NonNull private static IRiseClipseConsole console;
private static void usage() { private static void usage() {
console.setLevel( IRiseClipseConsole.INFO_LEVEL ); console.setLevel( IRiseClipseConsole.INFO_LEVEL );
console.info( console.info(
"java -jar RiseClipseValidatorSCL.jar [--info | --verbose] [--make-explicit-links] [<oclFile> | <nsdFile> | <sclFile>]*" ); "java -jar RiseClipseValidatorSCL.jar [--info | --warning | --verbose] [--make-explicit-links] [--use-color] [<oclFile> | <nsdFile> | <sclFile>]*" );
console.info( "Files ending with \".ocl\" are considered OCL files, " console.info( "Files ending with \".ocl\" are considered OCL files, "
+ "files ending with \\\".nsd\\\" are considered NSD files, " + "files ending with \\\".nsd\\\" are considered NSD files, "
+ "all others are considered SCL files" ); + "all others are considered SCL files" );
...@@ -74,30 +74,43 @@ public class RiseClipseValidatorSCL { ...@@ -74,30 +74,43 @@ public class RiseClipseValidatorSCL {
if( args.length == 0 ) usage(); if( args.length == 0 ) usage();
boolean makeExplicitLinks = false; boolean makeExplicitLinks = false;
boolean useColor = false;
boolean displayCopyright = true; boolean displayCopyright = true;
int consoleLevel = IRiseClipseConsole.WARNING_LEVEL;
int posFiles = 0; int posFiles = 0;
for( int i = 0; i < args.length; ++i ) { for( int i = 0; i < args.length; ++i ) {
if( args[i].startsWith( "--" ) ) { if( args[i].startsWith( "--" ) ) {
posFiles = i + 1; posFiles = i + 1;
if( "--info".equals( args[i] ) ) { if( "--info".equals( args[i] ) ) {
console.setLevel( IRiseClipseConsole.INFO_LEVEL ); consoleLevel = IRiseClipseConsole.INFO_LEVEL;
}
else if( "--warning".equals( args[i] ) ) {
consoleLevel = IRiseClipseConsole.WARNING_LEVEL;
} }
else if( "--verbose".equals( args[i] ) ) { else if( "--verbose".equals( args[i] ) ) {
console.setLevel( IRiseClipseConsole.VERBOSE_LEVEL ); consoleLevel = IRiseClipseConsole.VERBOSE_LEVEL;
} }
else if( "--make-explicit-links".equals( args[i] ) ) { else if( "--make-explicit-links".equals( args[i] ) ) {
makeExplicitLinks = true; makeExplicitLinks = true;
} }
else if( "--use-color".equals( args[i] ) ) {
useColor = true;
}
else if( "--do-not-display-copyright".equals( args[i] ) ) { else if( "--do-not-display-copyright".equals( args[i] ) ) {
displayCopyright = false; displayCopyright = false;
} }
else { else {
console = new TextRiseClipseConsole( useColor );
console.error( "Unrecognized option " + args[i] ); console.error( "Unrecognized option " + args[i] );
usage(); usage();
} }
} }
} }
console = new TextRiseClipseConsole( useColor );
console.setLevel( consoleLevel );
if( displayCopyright ) { if( displayCopyright ) {
int level = console.setLevel( IRiseClipseConsole.INFO_LEVEL ); int level = console.setLevel( IRiseClipseConsole.INFO_LEVEL );
...@@ -229,7 +242,7 @@ public class RiseClipseValidatorSCL { ...@@ -229,7 +242,7 @@ public class RiseClipseValidatorSCL {
List< ? > data = childDiagnostic.getData(); List< ? > data = childDiagnostic.getData();
EObject object = ( EObject ) data.get( 0 ); EObject object = ( EObject ) data.get( 0 );
if( data.size() == 1 ) { if( data.size() == 1 ) {
console.error( "\t" + childDiagnostic.getMessage() ); console.error( childDiagnostic.getMessage() );
} }
else if( data.get( 1 ) instanceof EAttribute ) { else if( data.get( 1 ) instanceof EAttribute ) {
EAttribute attribute = ( EAttribute ) data.get( 1 ); EAttribute attribute = ( EAttribute ) data.get( 1 );
...@@ -239,7 +252,7 @@ public class RiseClipseValidatorSCL { ...@@ -239,7 +252,7 @@ public class RiseClipseValidatorSCL {
+ childDiagnostic.getChildren().get( 0 ).getMessage() ); + childDiagnostic.getChildren().get( 0 ).getMessage() );
} }
else { else {
console.error( "\t" + childDiagnostic.getMessage() ); console.error( childDiagnostic.getMessage() );
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment