CheckStyle is a popular Java tool to ensure that source code adheres to a coding standard and is useful to enforcing style in a team or company. It is available for Eclipse as the Elipse CheckStyle plugin. CheckStyle is packaged along with this plugin and does not need to be separately installed.
CheckStyle comes pre-installed with the style of Google and other configuration files. You can view these listed in Window -> Preferences -> CheckStyle.
Add style: You can also add your own style configuration files by choosing New -> External Configuration File in the CheckStyle preferences dialog.
To set the styles to be applied on a project, right-click on it and choose Properties -> Checkstyle and choose the style you want from the dropdown.
Activate style: Activating CheckStyle for a project makes it check the project source files whenever they are saved. To do this, right-click on the project and choose CheckStyle -> Activate Checkstyle.
To manually check the style, right-click on the project and choose Properties -> Check Code with Checkstyle.
Tried with: CheckStyle 6.2, Eclipse 4.4.1 (Luna) and Ubuntu 14.04
You may sometimes need to selectively include or exclude certain files or directories in an Eclipse project. For example, I had a data subdirectory in my Eclipse project with thousands of files. Eclipse would spend lots of time needlessly indexing these files. This can be prevented by just excluding that directory from the project.
Right-click on the project and choose Properties. Choose Resource -> Resource Filters.
In the Resource Filters dialog, click Add and choose which files and directories to either Include Only or Exclude All. Only provide the file or directory name, not a relative path or absolute path!
Refresh the project to update these settings. The excluded files or directories should disappear from the project.
If you are curious, Eclipse puts this setting in the .project file for your project. For example, excluding a subdirectory named zoomba in a project, resulted in Eclipse adding this XML snippet to the .project:
Go to Help -> Install New Software. From the dropdown choose All Available Sites. After the list below fills up, choose Programming Languages -> Dynamic Languages Toolkit – Ruby Development Tools. Install it and restart Eclipse.
Configure the Ruby or JRuby interpreter you want to use in Window -> Preferences -> Ruby -> Interpreters.
You can create Ruby projects and edit, run and debug .rb files now in Eclipse! 🙂
Tried with: DLTK Ruby 5.0.0, Eclipse 4.4.1 and Ubuntu 14.04
The PyDev plugin adds support for working with Python files to Eclipse. However, it is only auto-configured to work with a Python 2.x interpreter. Furthermore, Ubuntu installs Python 2.x by default and needs some manual work to work with Python 3.x.
To use Python 3.x for your Python files in Eclipse:
First install Python 3.x:
$ sudo apt install python3
This installs the Python 3.x interpreter as /usr/bin/python3. We will use this in Eclipse.
In Eclipse, open Preferences -> PyDev -> Interpreters -> Python Interpreter. Click Add and add /usr/bin/python3. The Libraries and other settings will be auto-discovered by PyDev.
That is it! When you create a new Python project, in its dialog remember to pick Grammar version as 3.0 and the Interpreter as Python3.
Tried with: Python 3.4.0, PyDev 3.9.0, Eclipse Luna 4.4.1 and Ubuntu 14.04
PyDev can be configured to analyze your code to check if it complies with the PEP8 guidelines. It generates errors and warnings if the code does not comply. For example, E501 complains if a line is longer than 80 characters.
Sometimes, you may want to ignore some specific errors or warnings of PEP8. To do this, go to Windows -> Preferences -> PyDev -> Editor -> Code analysis -> PEP8.py. Here add an --ignore string with the error and warning numbers you want ignored. For example, --ignore=E501. Restart Eclipse for changes to take effect.
Tried with: PyDev 3.9.0, Python 3.4.0, Eclipse Luna 4.4.1 and Ubuntu 14.04
Eclipse can be used to work with Python files by installing the PyDev plugin (by pulling it online or manually. PyLint can be used to improve the quality of Python code and to ensure it complies with PEP 8 guidelines.
To enable and use PyLint in Eclipse:
Install PyLint. For Python 2.x, this can be done from Ubuntu repositories. If you are using Python 3.x, then see this post.
Go to Window -> Preferences -> PyDev -> PyLint.
Enable the Use PyLint option.
By default, the output of PyLint is displayed as text in the Console view. Instead, the problems found by PyLint can be marked as errors or warnings in your editor window and listed in the Problems view. These options can be set in the same dialog.
Add the path to the PyLint executable.
Choose how you want the various problems reported by PyLint to be reported as: error, warning or information.
Click Apply, then OK. Restart Eclipse.
Now whenever you save a Python file, PyLint is executed. Its output is either shown in the Console view or marked out in the Editor and shown in the Problems view.
Note: If PyLint does not execute when you save a Python file, see this post on how to fix this issue.
Tried with: PyLint 1.4.0, Eclipse Luna 4.4.1 and Ubuntu 14.04
Eclipse is developed as a modularized system with a central core platform and additional features and plugins that provide functionality required for a certain language (like Java or C++). These packaged versions of Eclipse that are put together for different languages is what is provided on its download page.
You may feel that the Eclipse packages available for Java or C++ (CDT) are extremely bloated with hundreds of features and plugins that you may never use. For example, Eclipse CDT includes hundreds of MyLyn features and cross-compiler support, none of which I may require right now. The beauty of Eclipse is that everything is a plugin, so you can actually build yourself a lean Eclipse that only includes what you want. This way you can build a minimal Eclipse that has only the features you want.
Step 1: Get the platform runtime binary
The core of Eclipse is provided for download as Eclipse Platform Runtime Binary. To get it, go to this page and click on the build number you want. It opens a new page, where you scroll down to the section named Platform Runtime Binary and download the package matching your system.
Unzip the zip file you downloaded and run the eclipse binary file. The IDE opens and it works.
Step 2: Add the plugins
Now add the plugins you want from Help -> Install New Software. For plugins provided by Eclipse, choose Luna from the dropdown. For external plugins, add their URL.
For creating a Eclipse C++ IDE of my own, I installed these plugins:
Luna -> Programming Languages -> C/C++ Development Tools