April 05 Prof. Ismael H. F. Santos - [email protected] 1 Modulo II Findbugs Professor Ismael...

30
April 05 Prof. Ismael H. F. Santos - [email protected] 1 Modulo II Findbugs Professor Ismael H F Santos – [email protected]

Transcript of April 05 Prof. Ismael H. F. Santos - [email protected] 1 Modulo II Findbugs Professor Ismael...

Page 1: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

April 05 Prof. Ismael H. F. Santos - [email protected] 1

Modulo II Findbugs

Professor Ismael H F Santos – [email protected]

Page 2: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 2

Introduction to Apache Maven 2 Tutorial ibm developerWorks:

Bibliografia

Page 3: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 3

Ementa

Traditional Build x Maven Build

Page 4: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 4

Descrição

Programa que usa análise estatística para procurar por bugs em código Java.

É software livre distribuido sob os termos da Licensa Pública GNU Menor.

É marca registrada da Universidade de Maryland.

É patrocinado pela Fortify Sotware.

Page 5: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 5

Descrição

Foi baixado mais de meio milhões de vezes desde Dezembro de 2007.

Requer JRE/JDK 1.5.0 ou maior para ser executado.

Pode analisar programas compilados com qualquer versão de Java.

Page 6: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 6

Como baixar o plugin da Internet e instalar no Eclipse

Dentro do Eclipse, clique em "Help->Software Updates->Find and Install".

Page 7: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 7

Como baixar o plugin da Internet e instalar no Eclipse

Selecione "Search for new features to install" e clique em "Next".

Page 8: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 8

Como baixar o plugin da Internet e instalar no Eclipse

Clique em "New Remote Site...".

Page 9: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 9

Como baixar o plugin da Internet e instalar no Eclipse

Digite "FindBugs" para o nome do plugin. Digite "http://findbugs.cs.umd.edu/eclipse" para a URL. Clique em "OK".

Page 10: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 10

Como baixar o plugin da Internet e instalar no Eclipse

Clique em "Finish".

Page 11: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 11

Como baixar o plugin da Internet e instalar no Eclipse

Aguarde a Busca.

Page 12: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 12

Como baixar o plugin da Internet e instalar no Eclipse

Clique nas setas à esquerda para abrir os detalhes. Marque "FindBugs". Clique em "Next".

Page 13: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 13

Como baixar o plugin da Internet e instalar no Eclipse

Selecione "I accept the terms in the license agreements". Clique em "Next".

Page 14: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 14

Como baixar o plugin da Internet e instalar no Eclipse

Clique em "Finish".

Page 15: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 15

Como baixar o plugin da Internet e instalar no Eclipse

Aguarde o downloading.

Page 16: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 16

Como baixar o plugin da Internet e instalar no Eclipse

Clique em "Install All".

Page 17: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 17

Como baixar o plugin da Internet e instalar no Eclipse

Aguarde a instalação.

Page 18: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 18

Como baixar o plugin da Internet e instalar no Eclipse

Clique em "Yes" para reiniciar o Eclipse.

Page 19: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 19

Como usar no Eclipse Clique com o botão direito do mouse no pom.xml do projeto. Selecione "Run As" e clique em "4 Maven build...".

Page 20: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 20

Como usar no Eclipse Clique em "Select...".

Page 21: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 21

Como usar no Eclipse Localize "findbugs" na lista, clique na seta à esquerda, clique em

"findbugs" e clique em "OK".

Page 22: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 22

Como usar no Eclipse Clique em "Run".

Page 23: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 23

Como usar no Eclipse O relatório será exibido em "Console" após a linha [findbugs:findbugs].

Page 24: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 24

Como usar no Eclipse Clique com o botão direito do mouse no projeto. Selecione "FindBugs" e clique em "FindBugs".

Page 25: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 25

Como usar no Eclipse A lista de erros aparecerá em "Problems".

Page 26: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 26

Como usar no Eclipse Clicando duas vezes na linha do erro, o código é aberto e a linha

contendo o erro é destacada em amarelo.

Page 27: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 27

Como usar no Eclipse Clicando com botão direito do mouse na linha do erro, uma lista de

opções aparecerá com a opção “Show Bug Details”

Page 28: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 28

Como usar no Eclipse Clicando na opção “Show Bug Details”, aparecera a aba ”Bug Details”

com detalhes do erro.

Page 29: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 29

Como usar no Eclipse Clicando no primeiro ícone do bug (vermelho), o Eclipse muda a

perspectiva para a do FindBugs.

Page 30: April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Modulo II Findbugs Professor Ismael H F Santos – ismael@tecgraf.puc-rio.brismael@tecgraf.puc-rio.br.

March 09 Prof. Ismael H. F. Santos 30

Fontes

http://findbugs.sourceforge.net/ http://findbugs.cs.umd.edu/eclipse/