-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add use relationship #3
base: development
Are you sure you want to change the base?
Changes from all commits
44ebc0e
f925af4
37ca173
a89edae
c53b46d
911908b
cfb52d4
0cd8e35
28ceda1
a158e4a
d21d3e9
4bfb211
854d864
0cb3793
b92b116
b0b2b4b
3a45b61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# jqa-php-plugin | ||
|
||
[](LICENSE) | ||
[](https://travis-ci.com/softvis-research/jqa-php-plugin) | ||
[](https://travis-ci.com/softvis-research/jqa-php-plugin) | ||
|
||
This is a php parser of jQAssistant. It enables jQAssistant to scan and to analyze php files. | ||
This is a php parser for jQAssistant. It enables jQAssistant to scan and to analyze php files. | ||
|
||
 |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
import java.io.File; | ||
import java.io.InputStream; | ||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
/** | ||
* | ||
* @author falk | ||
*/ | ||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Main.main()"); | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,6 @@ public interface PHPFunctionDescriptor extends PHPDescriptor, FullQualifiedNameD | |
String getName(); | ||
void setName(String name); | ||
|
||
/** | ||
* count of lines | ||
* @return integer | ||
*/ | ||
@Property("linesOfCode") | ||
int getLinesOfCode(); | ||
void setLinesOfCode(int linesOfCode); | ||
|
||
/** | ||
* Return all declared parameters of this method. | ||
* | ||
|
@@ -57,8 +49,34 @@ public interface PHPFunctionDescriptor extends PHPDescriptor, FullQualifiedNameD | |
* Number of first line in source file | ||
* @return integer | ||
*/ | ||
@Property("lineNumber") | ||
int getLineNumber(); | ||
void setLineNumber(int lineNumber); | ||
@Property("firstLineNumber") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the improvement. That is way clearer than before :) After improving the property name, the documentation does not add any value - it's redundant. Please remove it. |
||
int getFirstLineNumber(); | ||
void setFirstLineNumber(int firstLineNumber); | ||
|
||
/** | ||
* Number of last line in source file | ||
* @return integer | ||
*/ | ||
@Property("lastLineNumber") | ||
int getLastLineNumber(); | ||
void setLastLineNumber(int lastLineNumber); | ||
|
||
|
||
/** | ||
* count of lines with commands | ||
* @return integer | ||
*/ | ||
@Property("effectiveLineCount") | ||
int getEffectiveLineCount(); | ||
void setEffectiveLineCount(int effectiveLineCount); | ||
|
||
/** | ||
* Signature of function | ||
* @return integer | ||
*/ | ||
@Property("signature") | ||
String getSignature(); | ||
void setSignature(String signature); | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,18 @@ | |
@Label("Parameter") | ||
public interface PHPFunctionParameterDescriptor extends PHPDescriptor{ | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This documentation does not provide value. |
||
* Position of parameter | ||
* @return Integer | ||
*/ | ||
@Property("index") | ||
int getIndex(); | ||
|
||
void setIndex(int index); | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This documentation does not provide value. |
||
* Name of parameter | ||
* @return String | ||
*/ | ||
String getName(); | ||
void setName(String name); | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,10 @@ | |
@Label(value = "Namespace", usingIndexedPropertyOf = FullQualifiedNameDescriptor.class) | ||
public interface PHPNamespaceDescriptor extends PHPDescriptor, FullQualifiedNameDescriptor { | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant as well. |
||
* Name of namespace | ||
* @return String | ||
*/ | ||
String getName(); | ||
void setName(String name); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ | |
@Label("Field") | ||
public interface PHPPropertyDescriptor extends PHPDescriptor { | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant as well. |
||
* Name of field | ||
* @return String | ||
*/ | ||
String getName(); | ||
void setName(String name); | ||
|
||
|
@@ -34,6 +38,14 @@ public interface PHPPropertyDescriptor extends PHPDescriptor { | |
Boolean isStatic(); | ||
void setStatic(Boolean s); | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant as well. |
||
* is property constant | ||
* @return boolean | ||
*/ | ||
@Property("constant") | ||
Boolean isConstant(); | ||
void setConstant(Boolean c); | ||
|
||
/** | ||
* Number of line in source file | ||
* @return integer | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,10 @@ | |
@Label(value = "Type", usingIndexedPropertyOf = FullQualifiedNameDescriptor.class) | ||
public interface PHPTypeDescriptor extends PHPDescriptor, FullQualifiedNameDescriptor { | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant as well. |
||
* Name | ||
* @return String | ||
*/ | ||
String getName(); | ||
void setName(String name); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,45 +5,44 @@ | |
*/ | ||
package org.jqassistant.contrib.plugin.php.scanner; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.buschmais.jqassistant.core.scanner.api.Scanner; | ||
import com.buschmais.jqassistant.core.scanner.api.ScannerPlugin; | ||
import com.buschmais.jqassistant.core.scanner.api.Scope; | ||
import com.buschmais.jqassistant.core.store.api.Store; | ||
import com.buschmais.jqassistant.plugin.common.api.model.FileDescriptor; | ||
import com.buschmais.jqassistant.plugin.common.api.scanner.AbstractScannerPlugin; | ||
import com.buschmais.jqassistant.plugin.common.api.scanner.filesystem.FileResource; | ||
import java.io.File; | ||
import java.io.InputStream; | ||
import org.jqassistant.contrib.plugin.php.model.PHPFileDescriptor; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static java.util.Arrays.asList; | ||
import org.antlr.v4.runtime.CharStreams; | ||
import org.antlr.v4.runtime.CommonTokenStream; | ||
import org.antlr.v4.runtime.Lexer; | ||
import org.antlr.v4.runtime.TokenStream; | ||
import org.antlr.v4.runtime.tree.ParseTree; | ||
import org.apache.commons.io.FileUtils; | ||
import org.jqassistant.contrib.plugin.php.PhpLexer; | ||
import org.jqassistant.contrib.plugin.php.PhpParser; | ||
import org.jqassistant.contrib.plugin.php.scanner.parser.PHPFileParser; | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This documentation can be removed. |
||
* PHP file scanner | ||
* @author falk | ||
*/ | ||
@ScannerPlugin.Requires(FileDescriptor.class) | ||
public class PHPFileScannerPlugin extends AbstractScannerPlugin<FileResource, PHPFileDescriptor> { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(PHPFileScannerPlugin.class); | ||
|
||
public static final String JQASSISTANT_PLUGIN_PHP_SUFFIXES = "jqassistant.plugin.php.suffixes"; | ||
|
||
private static List<String> suffixes = asList("php", "phtml"); | ||
|
||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is no explanation for params or return values you can remove the lines accordingly. Something like that would be useful:
|
||
* check if file accepted by this plugin | ||
* @param item | ||
* @param path | ||
* @param scope | ||
* @return boolean | ||
* @throws IOException | ||
*/ | ||
@Override | ||
public boolean accepts(final FileResource item, final String path, final Scope scope) throws IOException { | ||
int beginIndex = path.lastIndexOf("."); | ||
|
@@ -61,19 +60,20 @@ public boolean accepts(final FileResource item, final String path, final Scope s | |
return false; | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This documentation does not provide any value. |
||
* scan php file | ||
* @param item | ||
* @param path | ||
* @param scope | ||
* @param scanner | ||
* @return PHPFileDescriptor | ||
* @throws IOException | ||
*/ | ||
@Override | ||
public PHPFileDescriptor scan(final FileResource item, final String path, final Scope scope, final Scanner scanner) throws IOException { | ||
final Store store = scanner.getContext().getStore(); | ||
FileDescriptor fileDescriptor = scanner.getContext().getCurrentDescriptor(); | ||
final PHPFileDescriptor phpFileDescriptor = store.addDescriptorType(fileDescriptor, PHPFileDescriptor.class); | ||
|
||
// try (BufferedReader reader = new BufferedReader(new InputStreamReader(item.createStream()))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for cleaning this up! |
||
// final PHPLineParser pumlLineParser = new PHPLineParser(store, phpFileDescriptor); | ||
// String line; | ||
// while ((line = reader.readLine()) != null) { | ||
// pumlLineParser.parseLine(line); | ||
// } | ||
// } | ||
FileDescriptor fileDescriptor = scanner.getContext().getCurrentDescriptor(); | ||
final PHPFileDescriptor phpFileDescriptor = store.addDescriptorType(fileDescriptor, PHPFileDescriptor.class); | ||
|
||
phpFileDescriptor.setName(item.getFile().getName()); | ||
|
||
|
@@ -83,6 +83,9 @@ public PHPFileDescriptor scan(final FileResource item, final String path, final | |
return phpFileDescriptor; | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This documentation does not provide any value. |
||
* configuration | ||
*/ | ||
@Override | ||
protected void configure() { | ||
super.configure(); | ||
|
@@ -97,5 +100,4 @@ protected void configure() { | |
|
||
LOGGER.info(String.format("php plugin looks for files with suffixes '%s'", suffixes.toString())); | ||
} | ||
|
||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't work on this plugin before. Is there a good reason to keep this file? Otherwise feel free to remove it.