|
From: <caw...@us...> - 2007-03-26 13:21:49
|
Revision: 2224
http://svn.sourceforge.net/rubyeclipse/?rev=2224&view=rev
Author: cawilliams
Date: 2007-03-26 06:08:53 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
remove unused compiler options, add the existing markers to errorProvider extension, so they show up as configurable in preference page
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/plugin.xml
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/CompilerOptions.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/ConstantReassignmentVisitor.java
Modified: trunk/org.rubypeople.rdt.core/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.core/plugin.xml 2007-03-26 13:08:04 UTC (rev 2223)
+++ trunk/org.rubypeople.rdt.core/plugin.xml 2007-03-26 13:08:53 UTC (rev 2224)
@@ -116,8 +116,14 @@
<extension
point="org.rubypeople.rdt.core.errorProvider">
<category id="org.rubypeople.rdt.errors.codeComplexity" name="Code Complexity" />
+
<category id="org.rubypeople.rdt.errors.potentialProblems" name="Potential programming problems" />
+ <error prefKey="org.rubypeople.rdt.core.compiler.problem.constantReassignment"
+ label="Re-Assignment to a constant"
+ categoryId="org.rubypeople.rdt.errors.potentialProblems"/>
+
<category id="org.rubypeople.rdt.errors.unneccesaryCode" name="Unnecessary code" />
+ <error prefKey="org.rubypeople.rdt.core.compiler.problem.emptyStatement" label="Empty Statements"
+ categoryId="org.rubypeople.rdt.errors.unneccesaryCode"/>
</extension>
-
</plugin>
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-03-26 13:08:04 UTC (rev 2223)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-03-26 13:08:53 UTC (rev 2224)
@@ -231,52 +231,14 @@
* @see #getDefaultOptions()
* @since 0.9.0
*/
- public static final String COMPILER_PB_ENSURE_BLOCK_NOT_COMPLETING = PLUGIN_ID + ".compiler.problem.ensureBlockNotCompletingNormally"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
- * @since 0.9.0
- */
public static final String COMPILER_PB_EMPTY_STATEMENT = PLUGIN_ID + ".compiler.problem.emptyStatement"; //$NON-NLS-1$
+
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
- */
- public static final String COMPILER_PB_HIDDEN_RESCUE_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenRescueBlock"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
* @since 0.9.0
*/
- public static final String COMPILER_PB_FALLTHROUGH_CASE = PLUGIN_ID + ".compiler.problem.fallthroughCase"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
- * @since 0.9.0
- */
- public static final String COMPILER_PB_NULL_REFERENCE = PLUGIN_ID + ".compiler.problem.nullReference"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
- */
- public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
- */
- public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
- * @since 0.9.0
- */
- public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
- /**
- * Possible configurable option ID.
- * @see #getDefaultOptions()
- * @since 0.9.0
- */
- public static final String COMPILER_PB_UNNECESSARY_ELSE = PLUGIN_ID + ".compiler.problem.unnecessaryElse"; //$NON-NLS-1$
+ public static final String COMPILER_PB_CONSTANT_REASSIGNMENT = PLUGIN_ID + ".compiler.problem.constantReassignment"; //$NON-NLS-1$
/**
* Possible configurable option ID.
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/CompilerOptions.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/CompilerOptions.java 2007-03-26 13:08:04 UTC (rev 2223)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/CompilerOptions.java 2007-03-26 13:08:53 UTC (rev 2224)
@@ -3,23 +3,26 @@
import java.util.HashMap;
import java.util.Map;
+import org.rubypeople.rdt.core.RubyCore;
+
public class CompilerOptions {
+
+ public static final long EmptyStatement = 0x01;
+ public static final long ConstantReassignment = 0x02;
- public static final String OPTION_ReportEmptyStatement = "org.rubypeople.rdt.core.compiler.problem.emptyStatement"; //$NON-NLS-1$
+ public static final String ERROR = RubyCore.ERROR; //$NON-NLS-1$
+ public static final String WARNING = RubyCore.WARNING; //$NON-NLS-1$
+ public static final String IGNORE = RubyCore.IGNORE; //$NON-NLS-1$
- public static final long EmptyStatement = 0x80000;
-
- public static final String ERROR = "error"; //$NON-NLS-1$
- public static final String WARNING = "warning"; //$NON-NLS-1$
- public static final String IGNORE = "ignore"; //$NON-NLS-1$
-
// Default severity level for handlers
public long errorThreshold = 0;
- public long warningThreshold = 0;
+ public long warningThreshold =
+ ConstantReassignment;
public Map getMap() {
Map optionsMap = new HashMap(30);
- optionsMap.put(OPTION_ReportEmptyStatement, getSeverityString(EmptyStatement));
+ optionsMap.put(RubyCore.COMPILER_PB_EMPTY_STATEMENT, getSeverityString(EmptyStatement));
+ optionsMap.put(RubyCore.COMPILER_PB_CONSTANT_REASSIGNMENT, getSeverityString(ConstantReassignment));
return optionsMap;
}
@@ -33,7 +36,8 @@
public void set(Map optionsMap) {
Object optionValue;
- if ((optionValue = optionsMap.get(OPTION_ReportEmptyStatement)) != null) updateSeverity(EmptyStatement, optionValue);
+ if ((optionValue = optionsMap.get(RubyCore.COMPILER_PB_EMPTY_STATEMENT)) != null) updateSeverity(EmptyStatement, optionValue);
+ if ((optionValue = optionsMap.get(RubyCore.COMPILER_PB_CONSTANT_REASSIGNMENT)) != null) updateSeverity(ConstantReassignment, optionValue);
}
void updateSeverity(long irritant, Object severityString) {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/ConstantReassignmentVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/ConstantReassignmentVisitor.java 2007-03-26 13:08:04 UTC (rev 2223)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/ConstantReassignmentVisitor.java 2007-03-26 13:08:53 UTC (rev 2224)
@@ -5,6 +5,7 @@
import org.jruby.ast.ConstDeclNode;
import org.jruby.evaluator.Instruction;
+import org.rubypeople.rdt.core.RubyCore;
public class ConstantReassignmentVisitor extends RubyLintVisitor {
@@ -17,8 +18,7 @@
@Override
protected String getOptionKey() {
- // FIXME Set up a compiler option for this!
- return null;
+ return RubyCore.COMPILER_PB_CONSTANT_REASSIGNMENT;
}
public Instruction visitConstDeclNode(ConstDeclNode iVisited) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|