jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

Sonar ends in error: no inputs were found in the config file #19433

Closed mraible closed 2 years ago

mraible commented 2 years ago
Overview of the issue

I created a new application with the main branch today and when I try to test its code quality with Sonar, I get an error.

Command used (from the application's README):

./gradlew -Pprod clean check jacocoTestReport sonarqube

Error:

Test Suites: 50 passed, 50 total
Tests:       185 passed, 185 total
Snapshots:   0 total
Time:        31.763 s
Ran all test suites.
Error: No inputs were found in config file '/Users/mraible/Downloads/21-points/tsconfig.json'. Specified 'include' paths were '[]' and 'exclude' paths were '["./build/resources/main/static/"]'.
    at createProgram (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/lib/programManager.js:65:15)
    at /Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/lib/server.js:36:61
    at Layer.handle [as handle_request] (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
    at /Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:341:12)
    at next (/Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:275:10)
    at /Users/mraible/Downloads/21-points/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/body-parser/lib/read.js:130:5

Sending the data to Sonar seems to have worked, but this error at the end is frightening.

Screen Shot 2022-08-15 at 17 40 07
Motivation for or Use Case

It'd be sweet if all the commands I show in the JHipster Mini-Book function without error.

Reproduce the error

Create a new app with the .yo-rc.json below. Start all the Docker containers the prod profile needs, plus Sonar.

docker-compose -f src/main/docker/elasticsearch.yml up -d
docker-compose -f src/main/docker/postgresql.yml up -d
docker-compose -f src/main/docker/sonar.yml up -d

Then, run all of the tests and the sonarqube task:

./gradlew -Pprod clean test sonarqube
JHipster Version(s)

main branch

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "TwentyOnePoints",
    "blueprints": [],
    "buildTool": "gradle",
    "cacheProvider": "ehcache",
    "clientFramework": "angularX",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1660602733560,
    "cypressAudit": false,
    "cypressCoverage": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entitySuffix": "",
    "herokuAppName": "vast-earth-71701",
    "herokuDeployType": "git",
    "herokuJavaVersion": "11",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.9.2",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "languages": ["en", "fr"],
    "messageBroker": false,
    "microfrontend": false,
    "microfrontends": [],
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "org.jhipster.health",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": "elasticsearch",
    "serverPort": "8080",
    "serverSideOptions": ["searchEngine:elasticsearch"],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": ["cypress"],
    "websocket": false,
    "withAdminUi": true
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

git version 2.32.1 (Apple Git-133)

node: v16.16.0

npm: 8.11.0

Docker version 20.10.17, build 100c701

docker-compose version 1.29.2, build 5becea4c

Browsers and Operating System
ubaid4j commented 2 years ago

Hi @mraible, @vishal423 can you please assign this issue to me? I'd like to fix this issue on my weekend. Thanks

mraible commented 2 years ago

I tried this again today with the above .yo-rc.json and the main branch. There are a bunch of test failures:

Summary of all failing tests
FAIL src/main/webapp/app/core/auth/account.service.spec.ts (384 MB heap size)
  ● Account Service › save › should call account saving endpoint with correct values

    Expected one matching request for criteria "Match method: POST, URL: api/account", found none.

      67 |       // WHEN
      68 |       service.save(account).subscribe();
    > 69 |       const testRequest = httpMock.expectOne({ method: 'POST', url: applicationConfigService.getEndpointFor('api/account') });
         |                                    ^
      70 |       testRequest.flush({});
      71 |
      72 |       // THEN

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/core/auth/account.service.spec.ts:69:36
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

FAIL src/main/webapp/app/core/auth/auth-jwt.service.spec.ts (545 MB heap size)
  ● Auth JWT › Login › should clear session storage and save in local storage when rememberMe is true

    Expected one matching request for criteria "Match URL: api/authenticate", found none.

      48 |       // WHEN
      49 |       service.login({ username: 'John', password: '123', rememberMe: true }).subscribe();
    > 50 |       httpMock.expectOne('api/authenticate').flush({ id_token: '1' });
         |                ^
      51 |
      52 |       // THEN
      53 |       httpMock.verify();

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/core/auth/auth-jwt.service.spec.ts:50:16
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

  ● Auth JWT › Login › should clear local storage and save in session storage when rememberMe is false

    Expected one matching request for criteria "Match URL: api/authenticate", found none.

      63 |       // WHEN
      64 |       service.login({ username: 'John', password: '123', rememberMe: false }).subscribe();
    > 65 |       httpMock.expectOne('api/authenticate').flush({ id_token: '1' });
         |                ^
      66 |
      67 |       // THEN
      68 |       httpMock.verify();

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/core/auth/auth-jwt.service.spec.ts:65:16
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

FAIL src/main/webapp/app/account/register/register.service.spec.ts (839 MB heap size)
  ● RegisterService Service › Service methods › should call register endpoint with correct values

    Expected one matching request for criteria "Match method: POST, URL: api/register", found none.

      37 |       service.save(registration).subscribe();
      38 |
    > 39 |       const testRequest = httpMock.expectOne({
         |                                    ^
      40 |         method: 'POST',
      41 |         url: applicationConfigService.getEndpointFor('api/register'),
      42 |       });

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/account/register/register.service.spec.ts:39:36
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

FAIL src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts (871 MB heap size)
  ● PasswordResetFinish Service › Service methods › should call reset-password/finish endpoint with correct values

    Expected one matching request for criteria "Match method: POST, URL: api/account/reset-password/finish", found none.

      33 |       service.save(key, newPassword).subscribe();
      34 |
    > 35 |       const testRequest = httpMock.expectOne({
         |                                    ^
      36 |         method: 'POST',
      37 |         url: applicationConfigService.getEndpointFor('api/account/reset-password/finish'),
      38 |       });

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts:35:36
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

FAIL src/main/webapp/app/account/password/password.service.spec.ts (757 MB heap size)
  ● Password Service › Service methods › should call change-password endpoint with correct values

    Expected one matching request for criteria "Match method: POST, URL: api/account/change-password", found none.

      33 |       service.save(password2, password1).subscribe();
      34 |
    > 35 |       const testRequest = httpMock.expectOne({
         |                                    ^
      36 |         method: 'POST',
      37 |         url: applicationConfigService.getEndpointFor('api/account/change-password'),
      38 |       });

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/account/password/password.service.spec.ts:35:36
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

FAIL src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts (803 MB heap size)
  ● PasswordResetInit Service › Service methods › should call reset-password/init endpoint with correct values

    Expected one matching request for criteria "Match method: POST, URL: api/account/reset-password/init", found none.

      32 |       service.save(mail).subscribe();
      33 |
    > 34 |       const testRequest = httpMock.expectOne({
         |                                    ^
      35 |         method: 'POST',
      36 |         url: applicationConfigService.getEndpointFor('api/account/reset-password/init'),
      37 |       });

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts:34:36
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

FAIL src/main/webapp/app/admin/logs/logs.service.spec.ts (777 MB heap size)
  ● Logs Service › Service methods › should change log level

    Expected one matching request for criteria "Match method: POST, URL: (any)", found none.

      25 |       service.changeLevel('main', 'ERROR').subscribe();
      26 |
    > 27 |       const req = httpMock.expectOne({ method: 'POST' });
         |                            ^
      28 |       expect(req.request.body).toEqual({ configuredLevel: 'ERROR' });
      29 |     });
      30 |   });

      at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
      at src/main/webapp/app/admin/logs/logs.service.spec.ts:27:28
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
      at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
      at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
      at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)

Test Suites: 7 failed, 43 passed, 50 total
Tests:       8 failed, 198 passed, 206 total
Snapshots:   0 total
Time:        13.508 s
Ran all test suites.

> Task :webapp_test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':webapp_test'.
> Process 'command '/Users/mraible/Downloads/21p/.gradle/npm/npm-v8.18.0/bin/npm'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 44s
mraible commented 2 years ago

The test failures seem to happen because of the jwtSecretKey. I deleted it from .yo-rc.json and regenerated the application. Then, I ran:

./gradlew -Pprod test sonarqube

The tests still fail:

Test Suites: 7 failed, 43 passed, 50 total
Tests:       8 failed, 198 passed, 206 total
Snapshots:   0 total
Time:        13.053 s
Ran all test suites.

> Task :webapp_test FAILED
mshima commented 2 years ago

@mraible main is having this problem too. Probably caused by https://github.com/jhipster/generator-jhipster/issues/19504

mshima commented 2 years ago

@UbaidurRehman1 have you managed to identify the problem? Can I take a look to clear 7.9.3 milestone?

ubaid4j commented 2 years ago

Hi @mshima I am not able to identify the problem yet, if its urgent then please go ahead.

Thanks

mraible commented 2 years ago

Re-assigned to @mshima.

mshima commented 11 months ago

@DanielFran bug bounty claimed https://opencollective.com/generator-jhipster/expenses/172338

DanielFran commented 11 months ago

@mshima approved