# Need help with include sc to bb

**URL:** <https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281>\
**Category:** SonarQube Cloud\
**Tags:** sonarqube-cloud\
**Created:** [February 18, 2020, 12:54pm UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281 "2020-02-18T12:54:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 18, 2020, 12:54pm UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/1 "2020-02-18T12:54:03Z")

</div>

I have a `bitbucket-pipelines.yml` for pull-requests.  
But when start `"Container 'docker' exceeded memory limit."`  
How to organize code verification at the moment pull-requests?

```
clone:
      depth: full 
definitions:
      caches:
            sonar: ~/.sonar/cache  
      services:
          docker:
            memory: 2048
      steps:
      - step: &build-test-sonarcloud
              size: 2x
              name: Build, test and analyze on SonarCloud
              caches:
              - sonar
              script:
              - pipe: sonarsource/sonarcloud-scan:1.0.1
              variables:
              DEBUG: "true"
              SONAR_SCANNER_OPTS: -Xmx512m

      - step: &check-quality-gate-sonarcloud
              name: Check the Quality Gate on SonarCloud
              script:
              - pipe: sonarsource/sonarcloud-quality-gate:0.1.3

pipelines:
  pull-requests:
    '**':
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
```

---

<div class="post-metadata">

**Author:** ![Gregoire\_Aubert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregoire_aubert/32/29_2.png) [@Gregoire\_Aubert](https://community.sonarsource.com/u/Gregoire_Aubert)\
**Post date:** [February 18, 2020, 1:39pm UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/3 "2020-02-18T13:39:17Z")

</div>

Hello,

And welcome to the community forum!

Do you have more log or information about when this happens exactly in the `build-test-sonarcloud` step ?

What’s the size of the project you are trying to analyze ? And what languages does it use ?

---

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 19, 2020, 5:36am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/4 "2020-02-19T05:36:59Z")

</div>

Hello.

> [@Gregoire\_Aubert](#):
>
> Do you have more log or information about when this happens exactly in the `build-test-sonarcloud` step ?

Yes, when start build-test-sonarcloud.  
Last log

`INFO: 540 source files to be analyzed`  
`INFO: 141/540 files analyzed, current file: docs/themes/default/js/vendor/jquery-ui.js`  
`INFO: 236/540 files analyzed, current file: docs/themes/frontend/desktope/libs/jquery-ui/jquery-ui.js`  
`INFO: 390/540 files analyzed, current file: docs/themes/frontend/desktope/modules/vin-request-list/components/vue-paginate.js`  
`INFO: 494/540 files a`

> [@Gregoire\_Aubert](#):
>
> What’s the size of the project you are trying to analyze ? And what languages does it use ?

php + js + html  
Size 400 mb

---

<div class="post-metadata">

**Author:** ![Gregoire\_Aubert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregoire_aubert/32/29_2.png) [@Gregoire\_Aubert](https://community.sonarsource.com/u/Gregoire_Aubert)\
**Post date:** [February 19, 2020, 8:51am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/5 "2020-02-19T08:51:48Z")

</div>

Ok thanks for the information.  
Is that the full log ? You don’t see any errors before is stops ?

And does the analysis work if you try to run it locally (not in Bitbucket pipeline) ?

---

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 20, 2020, 4:05am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/6 "2020-02-20T04:05:54Z")

</div>

> [@Gregoire\_Aubert](#):
>
> Is that the full log ?

No, this full log  
[pipelineLog-21.txt](https://community.sonarsource.com/uploads/short-url/3Me8hnrp3QoRuUHo7LrRFNrM2e1.txt) (13.4 KB)

> [@Gregoire\_Aubert](#):
>
> And does the analysis work if you try to run it locally (not in Bitbucket pipeline) ?

Yes, we launched the project locally, there were no errors, but I would like to automate this process

The main goal is to get bugs pull-requests, and fix them before release

---

<div class="post-metadata">

**Author:** ![Gregoire\_Aubert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregoire_aubert/32/29_2.png) [@Gregoire\_Aubert](https://community.sonarsource.com/u/Gregoire_Aubert)\
**Post date:** [February 20, 2020, 8:07am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/7 "2020-02-20T08:07:03Z")

</div>

Looking at the logs it seems like you are also analyzing all the code of the library you use in your project, I see a lot of jquery files. So you should start by ignoring all those files that are probably minified and will raise a lot of issue that you don’t want to fix. You can do it by setting the `sonar.exclusions` parameter.

I also noticed that you have some files that are not parsable by our css analyzer, so you wont get issues reported on these:

```auto
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/docs/themes/frontend/desktope/core/global.css, line 163, Unexpected }
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/docs/themes/default/css/jstree/default/style.css, line 605, Unknown word
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/docs/themes/default/css/acat.css, line 1008, Unclosed block

```

---

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 20, 2020, 8:59am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/8 "2020-02-20T08:59:00Z")

</div>

Thanks.  
You can still tell  
I use the following code to exclude unnecessary files, but for some reason it skips files .css and .js

```
 - step: &build-test-sonarcloud
          size: 2x
          name: Build, test and analyze on SonarCloud
          caches:
          - sonar
          script:
          - pipe: sonarsource/sonarcloud-scan:1.0.1
          variables:
          EXTRA_ARGS: -Dsonar.exclusions= **/*.xml,** /*.swf, **/*.js,** /*.css, **/*.less,.hg/** /*,deploy/ **/*,logs/** /*,node_modules/ **/*,docs/acat/** /*,docs/assets/ **/*,docs/build/** /*,docs/ckeditor/ **/*,docs/css/** /*,docs/ma/ **/*,docs/mobile/** /*,docs/pic/ **/*,docs/prices/** /*,docs/rt_files/ **/*,docs/tacat/** /*,docs/upload/ **/*,docs/xhprof/** /*,docs/protected/runtime/ **/*,docs/protected/vendor/** /*,docs/protected/extensions/ **/*,docs/upload_local/** /*,docs/upload/ **/*,docs/themes/** /*,docs/protected/views/**/*
          DEBUG: "true"
          SONAR_SCANNER_OPTS: -Xmx512m
```

---

<div class="post-metadata">

**Author:** ![Gregoire\_Aubert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregoire_aubert/32/29_2.png) [@Gregoire\_Aubert](https://community.sonarsource.com/u/Gregoire_Aubert)\
**Post date:** [February 20, 2020, 9:50am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/9 "2020-02-20T09:50:35Z")

</div>

Of course, because you have the following patterns in your exclusion:  
` **/*.js,** /*.css`

This mean ignore all js and css files everywhere is my project… So you probably want to review that exclusion list and try again.

---

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 20, 2020, 11:51am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/10 "2020-02-20T11:51:02Z")

</div>

Yes that’s right.  
At the first stage I want to exclude everything and check only one protected folder  
Then I tried to exclude all styles and js so as not to load bb  
Maybe you know how to make it select a specific folder for verification so that I don’t have to write a bunch of rules.  
Thanks

---

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 20, 2020, 12:49pm UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/11 "2020-02-20T12:49:58Z")

</div>

And one more mistake  
I removed the files but for some reason the sonar wants to check them and crashes  
I could not find the full description for setting bitbucket-pipelines.yml  
Can you suggest where you can see examples?  
If there are no examples, tell me how to select only the folders that interest me

[pipelineLog-24.txt](https://community.sonarsource.com/uploads/short-url/lVpMWhZiApvZcGthhEvQKgp0mJI.txt) (12.6 KB)

```
 - step: &build-test-sonarcloud
          size: 2x
          name: Build, test and analyze on SonarCloud
          caches:
          - sonar
          script:
          - pipe: sonarsource/sonarcloud-scan:1.0.1
          variables:
          EXTRA_ARGS: -Dsonar.exclusions= **/*.js,** /*.css,**/*.php
          DEBUG: "true"
          SONAR_SCANNER_OPTS: -Xmx512m
```

---

<div class="post-metadata">

**Author:** ![Gregoire\_Aubert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregoire_aubert/32/29_2.png) [@Gregoire\_Aubert](https://community.sonarsource.com/u/Gregoire_Aubert)\
**Post date:** [February 20, 2020, 12:58pm UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/12 "2020-02-20T12:58:45Z")

</div>

Yes it’s possible to select only the folders that interest you with `sonar.sources`, here is the doc for the existing [analysis parameters](https://sonarcloud.io/documentation/analysis/analysis-parameters/).

---

<div class="post-metadata">

**Author:** ![Tim\_Vasilaki](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tim_vasilaki/32/9535_2.png) [@Tim\_Vasilaki](https://community.sonarsource.com/u/Tim_Vasilaki)\
**Post date:** [February 21, 2020, 5:15am UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/13 "2020-02-21T05:15:21Z")

</div>

Ok.  
I do not understand.  
I started a test with parameters

```
EXTRA_ARGS: -Dsonar.sources='docs/protected/models/*' 

```

next test  
` EXTRA_ARGS: -Dsonar.sources=docs/protected/models/*`  
and next  
` EXTRA_ARGS: -Dsonar.sources=docs/protected/models/**.php`

But the scanner does not check files from these directories. Tell me what should be the setting to check the docs / protected / models / directory?  
I found only a description in the documentation, but I don’t see any examples

> Comma-separated paths to directories containing main source files. Read from build system for Maven, Gradle, MSBuild projects. Defaults to project base directory when neither `sonar.sources` nor `sonar.tests` is provided.

---

<div class="post-metadata">

**Author:** ![Gregoire\_Aubert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregoire_aubert/32/29_2.png) [@Gregoire\_Aubert](https://community.sonarsource.com/u/Gregoire_Aubert)\
**Post date:** [February 21, 2020, 1:40pm UTC](https://community.sonarsource.com/t/need-help-with-include-sc-to-bb/20281/14 "2020-02-21T13:40:07Z")

</div>

Looking at [this sample project](https://bitbucket.org/sonarsource/sample-nodejs-project/src/master/bitbucket-pipelines.yml), the following should work:

```auto
- pipe: sonarsource/sonarcloud-scan:1.0.1
  variables:
    EXTRA_ARGS: '-Dsonar.sources=docs/protected/models,another/directory'

```
