> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devinenterprise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Correggi automaticamente i bug nelle PR prima del merge

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Correggi automaticamente i bug nelle PR prima del merge" description="Devin esamina ogni PR per individuare bug e applica automaticamente le correzioni al branch." category="Qualità del codice" features="Integrazioni" type="review" />

<div className="uc-detail-wrapper">
  <Tip>Non vuoi configurare tutto manualmente? Incolla un collegamento a questa pagina in una sessione Devin e chiedigli di configurare tutto per te.</Tip>

  <Steps>
    <Step title="Registra repository e utenti per la revisione automatica">
      Devin Review può eseguire automaticamente la revisione di ogni PR sui tuoi repository — senza bisogno di avvii manuali. Inizia registrando i repository e gli utenti che vuoi coprire.

      1. Vai a [Settings > Review](https://app.devin.ai/settings/review?utm_source=docs\&utm_medium=use-case-gallery) nella webapp di Devin
      2. In **Repositories**, usa **Add repo** per cercare e aggiungere i repository che vuoi che Devin revisioni automaticamente (ad esempio, `acme/frontend`, `acme/api-server`)
      3. In **Users**, visualizza chi è registrato — ogni utente si registra autonomamente impostando il proprio trigger di revisione personale

      Una volta registrati, Devin esegue automaticamente la revisione dei PR quando vengono aperti, quando vengono effettuati nuovi push di commit o quando una bozza viene contrassegnata come pronta per la revisione.

      <Tip>
        Qualsiasi membro del team con un account GitHub collegato può registrarsi autonomamente alle revisioni automatiche — non sono necessari permessi di amministratore. Vai su [Settings > Preferences](https://app.devin.ai/settings/preferences?utm_source=docs\&utm_medium=use-case-gallery) e imposta il tuo **Review trigger** in **Devin Review**.
      </Tip>
    </Step>

    <Step title="Abilita Auto-Fix così Devin invia correzioni, non solo commenti">
      Per impostazione predefinita, [Devin Review](/it/work-with-devin/devin-review) pubblica i bug individuati come commenti inline. Auto-Fix va oltre — Devin propone modifiche al codice e può inviare direttamente i commit di correzione al branch del PR.

      Per abilitarlo, vai su **Settings > Customization > Pull requests > Responding to bots** e scegli una delle seguenti opzioni:

      * **Selected only** — aggiungi `devin-ai-integration[bot]` all’allowlist (consigliato)
      * **All bots** — Devin agisce su tutti i commenti dei bot, non solo sui propri

      Puoi anche abilitare Auto-Fix dalla sezione **Auto-fix** della barra laterale della revisione su qualsiasi PR creata da Devin (solo per gli amministratori dell’organizzazione).

      <Warning>
        "All bots" può causare loop infiniti se altri bot commentano anche sulle modifiche di Devin. Usa la modalità **Selected only** e aggiungi solo `devin-ai-integration[bot]` per rimanere al sicuro.
      </Warning>
    </Step>

    <Step title="Scopri cosa Devin individua e corregge">
      Quando viene aperto un PR su un repository registrato, Devin Review viene eseguito automaticamente e produce:

      * **Bug individuati** nella barra laterale Analysis, etichettati per gravità (Severe o Non-severe) e livello di confidenza
      * **Flag** per pattern che vale la pena approfondire ma non necessariamente errati
      * **Commit di correzione** inviati direttamente al branch del PR per i problemi che Devin può risolvere (quando Auto-Fix è attivo)

      Ad esempio, su un PR che aggiunge una nuova pagina di impostazioni utente, Devin Review potrebbe trovare:

      ```
      Bug (Severe): Null reference in UserSettings.tsx:38

      `user.preferences.theme` genera un’eccezione se `preferences` è undefined,
      cosa che accade per gli account creati prima della v2.3.

      Correzione inviata — commit e4a1b2c:
        const theme = user.preferences?.theme ?? 'system';
      ```

      Puoi esaminare ogni riscontro nella vista diff, contrassegnare i bug come risolti o porre domande di follow-up usando la [chat consapevole del codebase](/it/work-with-devin/devin-review) integrata — Devin ha il contesto dell’intero repository, non solo del diff.
    </Step>

    <Step title="Insegna a Devin Review gli standard del tuo team">
      Devin Review legge i file `AGENTS.md` e `REVIEW.md` nel tuo repository per imparare le convenzioni del tuo team. Usa questi file per definire preferenze di revisione, pattern di bug comuni da monitorare e standard di codifica che vuoi far rispettare:

      ```markdown theme={null}
      <!-- REVIEW.md -->
      ## Review guidelines

      - All API route handlers in src/routes/* must validate request body
        with zod schemas before accessing properties. Flag any handler
        that reads req.body fields without validation.
      - The useUnsafeEffect hook in src/hooks/useUnsafeEffect.ts is
        intentional — do not flag it as a missing-deps issue.
      - Check for unhandled error cases in API calls.
      - Ensure new database queries have appropriate indexes.
      ```

      Esegui il commit di questo file nel tuo repository e Devin Review seguirà queste linee guida su ogni PR. Aggiornalalo man mano che il tuo team scopre nuovi pattern — per esempio, dopo un bug in produzione, aggiungi il pattern che l’avrebbe intercettato così che Devin segnali problemi simili nelle revisioni future.

      Puoi anche usare la [Review chat](/it/work-with-devin/devin-review) su qualsiasi PR per chiedere a Devin di verificare pattern specifici all’interno del diff — per esempio: "Ci sono chiamate API in questo PR che non gestiscono il caso di errore?"
    </Step>
  </Steps>
</div>
