Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse file #24

Open
shyingsheng1980 opened this issue Jul 10, 2017 · 2 comments
Open

Unable to parse file #24

shyingsheng1980 opened this issue Jul 10, 2017 · 2 comments

Comments

@shyingsheng1980
Copy link

I was triying to test an Erlang analysis with our project, Erlang plugin is 1.2.

4 erlang files met parsing errors:

_ERROR: Unable to parse file: /repo/ebscchudso/jenkins-stable/workspace/shy-test-erlang/src/fm/fm_alarm_server.erl
ERROR: Parse error at line 182 column 41:

172: {ok, true};
173: _ ->
174: {ok, false}
175: end,
176: {reply,Reply,State};
177:
178: handle_call({check_pending_alarm, Id}, _From, State) ->
179: Reply =
180: case db_entry:read(?FM_ALARM_LIST, Id) of
181: [Alarm = #?FM_ALARM_LIST{action = pend}] ->
182: {ok,{Alarm#?FM_ALARM_LIST.info, Alarm#?FM_ALARM_LIST.timeout}};
^
183: _ ->
184: {error, not_pending}
185: end,
186: {reply,Reply,State};
187:
188: handle_call(Msg, _From, State) ->
189: ?LOG_MINOR(?DOMAIN, "Unhandled message",[{msg,Msg}]),
190: {reply, nok, State}.
191:
192: %%--------------------------------------------------------------------

ERROR: Unable to parse file: /repo/ebscchudso/jenkins-stable/workspace/shy-test-erlang/src/log/log_lib.erl
ERROR: Parse error at line 57 column 49:

47: -export([get_asi_audittrail_filename/0]).
48: -export([get_asi_security_filename/0]).
49:
50:
51: %% INCLUDE
52: -include_lib("kernel/include/file.hrl").
53: -include("main.hrl").
54: -include("logging.hrl").
55:
56: %% DEFINE
57: -define(CONT_WILD, "^(?!information_container_).*.tar.gz").
^
58:
59: %%===================================================================
60: %% EXPORTED - LIB FUNCTIONS
61: %%===================================================================
62:
63: %%------------------------------------------------------------------
64: try_lock() ->
65: TryLock =
66: fun() ->
67: case object_entry:get_parameters({{dmxcFunction,1},{logging,1}}, transferLogStatus) of

ERROR: Unable to parse file: /repo/ebscchudso/jenkins-stable/workspace/shy-test-erlang/src/oam/bgci_agent.erl
ERROR: Parse error at line 62 column 84:

52: -define(USER_TAG,"USER_NAME").
53: -define(NC_MODE_TAG,"NETCONF_MODE").
54: -define(MODE_COMMIT_AT_CLOSE_SESSION,"COMMIT_AT_CLOSE_SESSION").
55: -define(MODE_COMMIT_AT_EDIT_CONFIG,"COMMIT_AT_EDIT_CONFIG").
56: -define(AUTHEN_ERR,"AuthenticationFailed").
57: -define(AUTHEN_MSG,"System reject it due to it is unauthenticated request.").
58: -define(SYSTEM_ERR,"SystemFailed").
59: -define(SYSTEM_MSG,"System failed to allocate related resource.").
60: -define(MAXUSER_ERR,"Congestion").
61: -define(MAXUSER_MSG,"The connection for this client is excced the maximum.").
62: -define(PENDING_TIMEOUT_MSG,"The connection waiting time is excced the maximum(5s).").
^
63:
64: -define(ERRORMSG1," \n"
65: "<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:urn="urn:com:ericsson:ecim:ComTop" xmlns:urn1="urn:com:ericsson:ecim:Dmxc_Function" xmlns:urn2="urn:com:ericsson:ecim:DmxcEqm" message-id="311">\n"
66: "\n"
67: "application\n"
68: "").
69:
70: -define(ERRORMSG2,"\nerror\n"
71: "<error-message xml:lang="en>").
72:

ERROR: Unable to parse file: /repo/ebscchudso/jenkins-stable/workspace/shy-test-erlang/src/transport/pbf_lib.erl
ERROR: Parse error at line 51 column 55:

41: -define( ERS_HWPROFILE, {{ers,1}, {hwProfile,1}}).
42: -define( ERS_GROUP( GN), {{ers,1}, {hwProfile,1}, {policyGroup, GN}}).
43: -define( ERS_POLICIES, {{ers,1}, {policies,1}}).
44: -define( ERS_COUNTER( CN), {{ers,1}, {policies,1}, {counter, CN}}).
45: -define( ERS_POLICY( PN), {{ers,1}, {policies,1}, {policy, PN}}).
46: -define( ERS_INTERFACE( VR, IF), {{ers,1}, {ersTransport,1}, {ip,1}, {virtualRouter, VR}, {ipInterface, IF}}).
47: -define( ERS_ETHERNETPORT( EP), {{ers,1}, {ersTransport,1}, {ethernet,1}, {bridge, 1}, {ethernetPort, EP}}).
48: -define( ERS_CLASS(CLASS), {{ers,1},{policies,1},{policy,CLASS}}).
49:
50: -define( ERS_ATTRS, ['ethernet-port-ingress','ethernet-port-egress','ip-interface-ingress']).
51: -define( NO_INSTANCE, "is not available (no instance).").
^
52: -define( HWPROFILE_ATTRS, [
53: {maxClassIdVfp, 'max-class-id-vfp'}
54: ]).
55: -define( GROUP_ATTRS, [
56: {action, action},
57: {condition, condition},
58: {filterStage, 'filter-stage'},
59: {priority, priority},
60: {softMaxEntries, 'soft-max-entries'}
61: ])._

Can you please help to fix it?

@kalidasya
Copy link
Contributor

thanks will try to look into it

@FrankGiesecke
Copy link

FrankGiesecke commented Aug 1, 2017

We have the same problem while try to check an erlang 20 project.
Does #17 fix this issue?

INFO: Scanner configuration file: /sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/mw/mailingwork/blacklistsieve/sonar-project.properties
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_111-internal Oracle Corporation (64-bit)
INFO: Linux 3.10.0-514.26.2.el7.x86_64 amd64
INFO: User cache: /cache/.sonar/cache
INFO: Load global settings
INFO: Load global settings (done) | time=168ms
INFO: User cache: /cache/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=6ms
INFO: SonarQube server 6.3.1
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=24ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=22ms
INFO: Load active rules
INFO: Load active rules (done) | time=279ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=136ms
INFO: Publish mode
WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
INFO: Project key: mw-mailingwork-blacklistsieve
INFO: Branch key: feature/ci
INFO: -------------  Scan mw/mailingwork/blacklistsieve
INFO: Load server rules
INFO: Load server rules (done) | time=30ms
INFO: Initializer GenericCoverageSensor
INFO: Initializer GenericCoverageSensor (done) | time=0ms
INFO: Base dir: /builds/mw/mailingwork/blacklistsieve
INFO: Working dir: /builds/mw/mailingwork/blacklistsieve/.sonar
INFO: Source paths: src
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
INFO: 41 files indexed
INFO: Quality profile for erlang: Sonar way
INFO: Sensor ErlangSquidSensor [erlang]
ERROR: Unable to parse file: /builds/mw/mailingwork/blacklistsieve/src/bl_blacklist_check_srv.erl
ERROR: Parse error at line 162 column 9:

152:     false -> false;
153:     _ -> {error, table}
154:    end;
155:   
156:   _ -> false
157:  end;
158: 
159: check2(wildcard, Address, Table) ->
160:  F=
161:  fun
162:   Check ('$end_of_table') -> false;
             ^
163:   
164:   Check ({[{RegExp}], Cont}) ->
165:     case re:run(Address, RegExp, [{capture, none}, global]) of
166:      match -> true;
167:      nomatch -> Check(ets:match_object(Cont));
168:      {error, _} -> Check(ets:match_object(Cont))
169:     end
170:  end,
171:  
172:  case catch F(ets:match_object(Table, '_', 1)) of

ERROR: Unable to parse file: /builds/mw/mailingwork/blacklistsieve/src/bl_blacklist_fetcher_srv.erl
ERROR: Parse error at line 59 column 18:

49:  {ok, Pid}=mysql:get_connection(),
50:  
51:  R=
52:  case mysql:connect(Pid, ConnectData) of
53:   {ok, _} ->
54:    mysql:execute_query(Pid, <<"SET SESSION net_write_timeout=300">>),
55:    case mysql:execute_query(Pid, <<"SELECT `type`, LOWER(TRIM(`address`)) FROM `blacklist_email`">>) of
56:     {coldefs, _} ->
57:      F=
58:      fun
59:       FillTables (true, true) ->
                     ^
60:        {Ok, More}=
61:        case mysql:get_resultset_row(Pid) of
62:         {row, [<<"static">>, RawAddress]} ->
63: %%          NormalizedAddress=bl_util:normalize_address(re:replace(RawAddress, NormalizeMP, "", [{return, binary}, global])),
64:          NormalizedAddress=bl_util:normalize_address(binary:replace(RawAddress, NormalizeMP, <<>>, [global])),
65:          ets:insert(TS, {NormalizedAddress}),
66:          {true, true};
67:         
68:         {row, [<<"wildcard">>, RawAddress]} ->
69: %%          NormalizedAddress=bl_util:normalize_address(re:replace(RawAddress, NormalizeMP, "", [{return, binary}, global])),

WARN: Metric 'lines' is an internal metric computed by SonarQube. Provided value is ignored.
INFO: Sensor ErlangSquidSensor [erlang] (done) | time=3308ms
INFO: Sensor EunitXmlSensor [erlang]
INFO: Sensor EunitXmlSensor [erlang] (done) | time=0ms
INFO: Sensor CoverCoverageSensor [erlang]
WARN: no files end with .html in /builds/mw/mailingwork/blacklistsieve/.eunit
INFO: Sensor CoverCoverageSensor [erlang] (done) | time=1ms
INFO: Sensor DialyzerSensor [erlang]
WARN: Dialyser file not found at: dialyzer.log, have you ran dialyzer before analysis?
java.io.FileNotFoundException: /builds/mw/mailingwork/blacklistsieve/.eunit/dialyzer.log (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at org.sonar.plugins.erlang.dialyzer.DialyzerReportParser.dialyzer(DialyzerReportParser.java:82)
	at org.sonar.plugins.erlang.dialyzer.DialyzerSensor.analyse(DialyzerSensor.java:64)
	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
	at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
	at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)

INFO: Sensor DialyzerSensor [erlang] (done) | time=3ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor Analyzer for "php.ini" files [php]
INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=4ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=49ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=142ms
INFO: Sensor CPD Block Indexer
INFO: org.sonar.scanner.cpd.deprecated.DefaultCpdBlockIndexer@7edb6fca is used for erlang
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 7.308s
ERROR: Error during SonarQube Scanner execution
INFO: Final Memory: 43M/235M
INFO: ------------------------------------------------------------------------
com.sonar.sslr.api.RecognitionException: Parse error at line 162 column 9:

152:     false -> false;
153:     _ -> {error, table}
154:    end;
155:   
156:   _ -> false
157:  end;
158: 
159: check2(wildcard, Address, Table) ->
160:  F=
161:  fun
162:   Check ('$end_of_table') -> false;
             ^
163:   
164:   Check ({[{RegExp}], Cont}) ->
165:     case re:run(Address, RegExp, [{capture, none}, global]) of
166:      match -> true;
167:      nomatch -> Check(ets:match_object(Cont));
168:      {error, _} -> Check(ets:match_object(Cont))
169:     end
170:  end,
171:  
172:  case catch F(ets:match_object(Table, '_', 1)) of

	at org.sonar.sslr.parser.ParserAdapter.parse(ParserAdapter.java:114)
	at org.sonar.sslr.parser.ParserAdapter.parse(ParserAdapter.java:88)
	at org.sonar.plugins.erlang.cpd.ErlangTokenizer.tokenize(ErlangTokenizer.java:49)
	at org.sonar.duplications.internal.pmd.TokenizerBridge.chunk(TokenizerBridge.java:60)
	at org.sonar.duplications.internal.pmd.TokenizerBridge.chunk(TokenizerBridge.java:52)
	at org.sonar.scanner.cpd.deprecated.DefaultCpdBlockIndexer.populateIndex(DefaultCpdBlockIndexer.java:88)
	at org.sonar.scanner.cpd.deprecated.DefaultCpdBlockIndexer.index(DefaultCpdBlockIndexer.java:79)
	at org.sonar.scanner.cpd.deprecated.DeprecatedCpdBlockIndexerSensor.execute(DeprecatedCpdBlockIndexerSensor.java:76)
	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
	at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
	at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
ERROR: Job failed: exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants