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

Bad support of heredoc notations #166

Closed
dosyfier opened this issue Sep 11, 2019 · 0 comments · Fixed by #190 or #191
Closed

Bad support of heredoc notations #166

dosyfier opened this issue Sep 11, 2019 · 0 comments · Fixed by #190 or #191
Assignees
Milestone

Comments

@dosyfier
Copy link

Expected behavior

Heredoc notation is a common way to define usage functions within shell scripts.
It is expected from i-Code analysis to support such notation.

Actual behavior

When a heredoc syntax is used with text containing an apostrophe, i-Code stops the analysis (no further analysis of any file given as argument to i-Code). The following error is displayed:

!ENTRY org.eclipse.osgi 4 0 2019-09-11 13:16:02.795
!MESSAGE Application error
!STACK 1
fr.cnes.analysis.tools.analyzer.exception.JFlexException: i-Code CNES analysis encountered a problem.

Analysis failure : At least one function is not ending correctly.
CheckerId: fr.cnes.analysis.tools.shell.metrics.SHMETNesting
File: sample.sh
Line:11
Column:0
Last word scanned : [] []
Please report this issue on : https://github.com/dupuisa/i-CodeCNES/issues/
	at fr.cnes.analysis.tools.shell.metrics.SHMETNesting.run(SHMETNesting.java:841)
	at fr.cnes.analysis.tools.analyzer.CallableChecker.call(CallableChecker.java:65)
	at fr.cnes.analysis.tools.analyzer.CallableChecker.call(CallableChecker.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Icode: Cannot open display: 
Icode:

Steps to reproduce behavior

Create a sample script (sample.sh) with the following content:

#!/bin/bash

usage() {
  cat <<-EOU
  Usage : myfunction [options] parameters

  Downloads JARs into this script's directory.
EOU
}

usage

and simply run icode on it: <i-code_install_path>/icode sample.sh.
If I simply remove the 's after the word script, the previous error goes away.

Detection version

3.0.0

@begarco begarco self-assigned this Sep 15, 2019
@begarco begarco added this to the Version 4.0.0 milestone Sep 17, 2019
@begarco begarco mentioned this issue Feb 9, 2020
begarco added a commit that referenced this issue Feb 10, 2020
* Refactoring for i-Code 4 (#164)

* start of refactoring to remove rcp from command line and core analyzer

* Second step

* All languages are built

* Fix export string problem and add new supported features

* All rules integrated.

* Finalized command line version.
- three languages supported
- plugin system available
- packaging on build available
- directory as argument available
- deletion of parallel analysis

* Add version information to command line

* Add parametrized unit tests

* Update .travis.yml

* fix encoding issues, prepare new packagings and clean up repository

* update pom to fix issues and deploy library

* fix shell-rules pom

* minor changes

* Refactoring

* Add functional icode-ide working with a icode-libray jar put in icode-library-plugin // Refactor code // Add some license headers

* RCP versions are reintegrated as icode-ide

* Update CI (deploy and jdk) + start new readme

* Update .travis.yml

* Change to icode 4 + README

* Change README

* Update README.md

* Fix compatibility with JRE>8 && update CI

* deploy only on build on jdk11

* Remove build on jdk8

* [#166] Fix #166 by adding heredoc support to metrics

* [#166] Fix #166 by adding heredoc support to metrics

* [#166] Fix #166 by adding here string support to shell metrics

* [#145] Add coverage with jacoco

* [#142] Add i-Code version in xml reports

* Fix #168: support of for with double parentheses

* Fix #158 Remove 'read' from active wait functions

* #187 Complete contributing requirements

* #187 Fix layout

* #187 fix plan

* #187 Add issue templates

* #187 add a template with checklist for PR

* Delete PULL_REQUEST_TEMPLATE.md

Move template into .github folder

* Delete ISSUE_TEMPLATE.md

Move template into .github

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* #165 add execution rights for icode-app scripts

* #158 fix tests

* #165 Update README to match the new structure

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update README.md

* Add coverage for SonarQube

* Use Junit Jupiter 5 to run tests

* Convert test to JUnit 5 tests with generalisation of chercker tests

* add sonar-project.properties
@begarco begarco mentioned this issue Feb 10, 2020
@begarco begarco mentioned this issue Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants