# SonarCloud don't check new code from Pull Requests Azure DevOps

**URL:** <https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208>\
**Category:** Report False-positive / False-negative...\
**Tags:** javascript, sonarqube-cloud\
**Created:** [August 22, 2022, 3:24pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208 "2022-08-22T15:24:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![BobbaCat](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bobbacat/32/36373_2.png) [@BobbaCat](https://community.sonarsource.com/u/BobbaCat)\
**Post date:** [August 22, 2022, 3:24pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/1 "2022-08-22T15:24:11Z")

</div>

SonarCloud is integrated with Azure DevOps

**yml file:**

```auto
name: Azure Static Web Apps CI/CD
pr:
  branches:
    include:
      - dev
trigger:
  branches:
    include:
      - dev
jobs:
- job: build_and_deploy_job
  displayName: Build and Deploy Job
  condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
  pool:
    vmImage: ubuntu-latest
  variables:
  - group: Azure-Static-Web-Apps-delightful-beach-016f25c03-variable-group
  steps:
  - checkout: self
    submodules: true
  - task: SonarCloudPrepare@1
    inputs:
      SonarCloud: 'SonarCloud'
      organization: 'xxxxxxx'
      scannerMode: 'CLI'
      configMode: 'manual'
      cliProjectKey: 'xxxxx'
      cliProjectName: 'xxxx'
      cliProjectVersion: '2.0'
      cliSources: 
  - task: AzureStaticWebApp@0
    inputs:
      azure_static_web_apps_api_token: $(xxxxxxx)
      app_location: "_static" # App source code path
      api_location: "" # Api source code path - optional
      output_location: "" # Built app content directory - optional
  - task: SonarCloudAnalyze@1
  - task: SonarCloudPublish@1
    inputs:
      pollingTimeoutSec: '300'

```

- Languages of the repository Javascript, HTML, CSS

- Steps to reproduce

**1 - I created a new pull request with code errors**

 ![2022-08-22 17_08_51](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/a/5/a5a899fd4964b515a577b64a5b20f50fb94f97be.png)

**2 - SonarCloud doesn’t find any errors:**

 ![2022-08-22 17_09_07](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/0/5/05fa00f5478ad7fe8b11ec13ce0e2da514d4faf4.png)

**New Code settings - Specific date (from Jan 01 2022)**

**Overall code reviews have errors, but neither new code nor pull requests don’t**

**Please help to fix this issue.**

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [August 22, 2022, 6:00pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/2 "2022-08-22T18:00:35Z")

</div>

Hi,

Welcome to the community!

Could you be explicit about what issues you’re expecting to be raised on your PR?

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![BobbaCat](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bobbacat/32/36373_2.png) [@BobbaCat](https://community.sonarsource.com/u/BobbaCat)\
**Post date:** [August 22, 2022, 9:11pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/3 "2022-08-22T21:11:07Z")

</div>

Hi Ann,  
Expected result - receive review of pull request code from SonarCloud.

So I’m looking for solution - how to reach expected result.

Generally issue is that SonarCloud doesn’t review pull requests at all and always says that code is fine.  
But code has with errors and bugs.

Probably the reason is somewhere in difference between new code and old code.

I will be very glad to receive a help.

Regards,  
Bogdan

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [August 23, 2022, 11:49am UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/4 "2022-08-23T11:49:49Z")

</div>

Hi Bogdan,

> [@BobbaCat](#):
>
> Expected result - receive review of pull request code from SonarCloud.

Yeah, I got that part already.

> [@BobbaCat](#):
>
> always says that code is fine.  
> But code has with errors and bugs.

What I want to know is what “errors and bugs” you expect to see PR analysis flagging.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![BobbaCat](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bobbacat/32/36373_2.png) [@BobbaCat](https://community.sonarsource.com/u/BobbaCat)\
**Post date:** [August 23, 2022, 1:38pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/5 "2022-08-23T13:38:57Z")

</div>

Hi Ann,  
Bugs, Vulnerabilities, and Code Smell according to SonarCloud rules:

> **[SonarSource Code Analyzers Rules Explorer](https://rules.sonarsource.com/javascript/type/Bug/RSPEC-4275)**
>
> Discover all the bugs, vulnerabilities, security hotspots and code smells automatically detected by SonarSource code analyzers in 30 programming languages

For example, I take the wrong code from SonarCloud rules example and SonarCloud after checking the Pull Request said this code if fine

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [August 23, 2022, 2:26pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/6 "2022-08-23T14:26:07Z")

</div>

Hi,

> [@BobbaCat](#):
>
> For example, I take the wrong code from SonarCloud rules example and SonarCloud after checking the Pull Request said this code if fine

Thanks. This is in the direction of what I’m after. And could you be more specific? Like, could you provide the specific rule you expected to see an issue from? Because I’d like to verify that the rules in question are in the default profile.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![BobbaCat](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bobbacat/32/36373_2.png) [@BobbaCat](https://community.sonarsource.com/u/BobbaCat)\
**Post date:** [August 23, 2022, 4:00pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/7 "2022-08-23T16:00:36Z")

</div>

Hi Ann,  
Here’s an example from the last SonarClour run:  
I take bad code from [https://rules.sonarsource.com/javascript/type/Bug/RSPEC-4275](https://rules.sonarsource.com/javascript/type/Bug/RSPEC-4275) and put it into 2 different files.

On one page SonarCloud finds it as a bad code.  
On another page - as good code

**Page with errors**

 ![2022-08-23 17_52_19](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/9/0/902b5deee6366609bcb0dbac024a680f52848065.png)

**Page without errors**

 ![2022-08-23 17_52_45](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/c/1/c1660af8cf6dd46b0cb301ce2e9cb1131ff2dc4f.png)

Especially these 3 lines of code:

```auto
const datePattern = /\d{4}-\d{2}-\d{2}/g;
datePattern.test('2020-08-06');
datePattern.test('2019-10-10');

```

On page with errors, they are on lines 189-191  
On page without errors, they are on lines 318-322

Regards,  
Bogdan

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [August 24, 2022, 12:06pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/8 "2022-08-24T12:06:45Z")

</div>

Hi Bogdan,

Thanks for this. Would it be possible to provide the file where no issue was raised? Also, are there any errors in your analysis log about parsing?

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![BobbaCat](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bobbacat/32/36373_2.png) [@BobbaCat](https://community.sonarsource.com/u/BobbaCat)\
**Post date:** [August 25, 2022, 10:27am UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/9 "2022-08-25T10:27:28Z")

</div>

Hi Ann,  
I had a few errors with parsing files. Like that:  
##[error]ERROR: Failed to parse file [src/pages/xxxt.js] at line 107: Unexpected token (107:25)  
But it’s other files that are in no way connected with files from my issue.

There are no errors in files from my issue.  
I can share both files (where errors were detected and where - don’t, but only through private messages, as it’s not a public project)

Bogdan

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [August 25, 2022, 11:21am UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/11 "2022-08-25T11:21:15Z")

</div>

Hi Bogdan,

I’ve referred this to the experts. Hopefully they’ll be a long soon & initiate that private thread.

&nbsp;  
Thx,  
Ann

---

<div class="post-metadata">

**Author:** ![victor.diez](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/victor.diez/32/38525_2.png) [@victor.diez](https://community.sonarsource.com/u/victor.diez)\
**Post date:** [September 6, 2022, 12:39pm UTC](https://community.sonarsource.com/t/sonarcloud-dont-check-new-code-from-pull-requests-azure-devops/70208/14 "2022-09-06T12:39:06Z")

</div>

Closed on September 6, 2022, 12:39pm UTC

closing topic as user bypassed the issue by creating a new project
