What is Sensei?
The Sensei plugin provides an easy way to find specific code patterns in your source code, and then apply rewrite rules to amend the matching code. All within the Intellij IDE, and in real-time.
For example, you could create a rule that matches on JUnit `@Disabled` annotations which do not have a reason, Sensei would then tell you about the issue by highlighting the code in the IDE.
Additionally, when you `alt+enter`, you can have the option to `Add a todo comment parameter`.
When selected, this would amend the code to add a boilerplate reason, which you can then amend, and if you don't, it will show up in your TODO panel.
e.g. `@Disabled` would become ` @Disabled("TODO: add a description here")`
Sensei combines the functionality of a Static Analysis code scanner with a code rewriting engine.
IntelliJ Intention Actions
Based on the above description, the obvious alternative (if you were not using Sensei) is to use the IntelliJ Intention Actions functionality.
Sensei differs from IntelliJ Intention Actions because the aim with Sensei is to provide a way to create matchers and rewriters which are project specific, or even local to an individual developer.
We have tried to put together a GUI that makes both the matching and rewrite rules easy to write and experiment with.
How can it help me personally improve?
When I'm learning a new library, it takes me time to build up muscle memory around the methods and formatting. So I might choose to create personal recipes which
- link off to the official documentation or tutorial pages
- have boilerplate templates which are most effective
- fix poor coding practices
- add boilerplate code to help use a library
I can use Sensei to build temporary recipes which prompt me for the current practices I've chosen to use and help me build up effective habits. And the recipes are temporary because I can remove them when I outgrow them.
How can it help my team improve?
In the same way we can help teams build up muscle memory around agreed coding standards.
Creating cookbooks of recipes that we apply when we find the same comments in pull request reviews. Since the cookbooks are stored in version control with the project, they are available to everyone on the project. And we can switch them off when we no longer need prompting.
Sensei helps provide feedback early
What we've tried to build with Sensei is a way of pulling the feedback that helps us improve, and reminders of corrective action, as early into the coding process as we can.
Rather than wait for
- the results of a static analyser
- the comments from a code review
We can instead see the feedback, for custom standards we want to enforce, as we code.
And we have either reminders, or actual rewrite rules, to help us write code that complies with the standards.
Sensei is flexible
In that way, Sensei is a bit of a mix, since it's:
- part Static Analyser
- coding tutor
- rewrite engine
Sensei is flexible enough to make the job of saying "What is Sensei?" that little bit harder.
Sensei fills a gap in the programming workflow
We've tried to make Sensei the missing piece of the programmer workflow that helps you improve specific elements in your coding style, or library use, that you and your team are currently working with.
This flexibility means that it takes a little more time to get to grips with Sensei than a static analysis tool or the built-in IntelliJ Intentions. Still, by spending the time to experiment, you will gain a new way to speed up your learning in your personal development process.
How to experiment?
Once you have downloaded and installed Sensei from the [Intellij Marketplace]
The easiest way to make Sensei work for you is to look at your coding process and consider:
- What documentation do you keep looking up?
-- You could add some Sensei recipes that link back to that documentation. - What simple mistakes do you keep making?
-- You could temporarily codify that poor coding pattern as a matcher, and write a Quick Fix rewrite that amends the code to be what you really want to write. - What boilerplate code do you write to use a library?
-- You could create a Quick Fix rule to write the code for you.
Since Sensei is designed to work alongside whatever static analysis tool you're using, if you find that the same violations are being reported from static analysis, then you could replicate the condition in a Sensei recipe. You can then add a Quick Fix to help train you, not just to identify the mistake, but also to move quickly to writing the correct code
The Sensei plugin provides an easy way to find specific code patterns in your source code, and then apply rewrite rules to amend the matching code. All within the Intellij IDE, and in real-time.
Alan Richardson has more than twenty years of professional IT experience, working as a developer and at every level of the testing hierarchy from Tester through to Head of Testing. Head of Developer Relations at Secure Code Warrior, he works directly with teams, to improve the development of quality secure code. Alan is the author of four books including “Dear Evil Tester”, and “Java For Testers”. Alan has also created online training courses to help people learn Technical Web Testing and Selenium WebDriver with Java. Alan posts his writing and training videos on SeleniumSimplified.com, EvilTester.com, JavaForTesters.com, and CompendiumDev.co.uk.
Secure Code Warrior is here for your organization to help you secure code across the entire software development lifecycle and create a culture in which cybersecurity is top of mind. Whether you’re an AppSec Manager, Developer, CISO, or anyone involved in security, we can help your organization reduce risks associated with insecure code.
Book a demoAlan Richardson has more than twenty years of professional IT experience, working as a developer and at every level of the testing hierarchy from Tester through to Head of Testing. Head of Developer Relations at Secure Code Warrior, he works directly with teams, to improve the development of quality secure code. Alan is the author of four books including “Dear Evil Tester”, and “Java For Testers”. Alan has also created online training courses to help people learn Technical Web Testing and Selenium WebDriver with Java. Alan posts his writing and training videos on SeleniumSimplified.com, EvilTester.com, JavaForTesters.com, and CompendiumDev.co.uk.
The Sensei plugin provides an easy way to find specific code patterns in your source code, and then apply rewrite rules to amend the matching code. All within the Intellij IDE, and in real-time.
For example, you could create a rule that matches on JUnit `@Disabled` annotations which do not have a reason, Sensei would then tell you about the issue by highlighting the code in the IDE.
Additionally, when you `alt+enter`, you can have the option to `Add a todo comment parameter`.
When selected, this would amend the code to add a boilerplate reason, which you can then amend, and if you don't, it will show up in your TODO panel.
e.g. `@Disabled` would become ` @Disabled("TODO: add a description here")`
Sensei combines the functionality of a Static Analysis code scanner with a code rewriting engine.
IntelliJ Intention Actions
Based on the above description, the obvious alternative (if you were not using Sensei) is to use the IntelliJ Intention Actions functionality.
Sensei differs from IntelliJ Intention Actions because the aim with Sensei is to provide a way to create matchers and rewriters which are project specific, or even local to an individual developer.
We have tried to put together a GUI that makes both the matching and rewrite rules easy to write and experiment with.
How can it help me personally improve?
When I'm learning a new library, it takes me time to build up muscle memory around the methods and formatting. So I might choose to create personal recipes which
- link off to the official documentation or tutorial pages
- have boilerplate templates which are most effective
- fix poor coding practices
- add boilerplate code to help use a library
I can use Sensei to build temporary recipes which prompt me for the current practices I've chosen to use and help me build up effective habits. And the recipes are temporary because I can remove them when I outgrow them.
How can it help my team improve?
In the same way we can help teams build up muscle memory around agreed coding standards.
Creating cookbooks of recipes that we apply when we find the same comments in pull request reviews. Since the cookbooks are stored in version control with the project, they are available to everyone on the project. And we can switch them off when we no longer need prompting.
Sensei helps provide feedback early
What we've tried to build with Sensei is a way of pulling the feedback that helps us improve, and reminders of corrective action, as early into the coding process as we can.
Rather than wait for
- the results of a static analyser
- the comments from a code review
We can instead see the feedback, for custom standards we want to enforce, as we code.
And we have either reminders, or actual rewrite rules, to help us write code that complies with the standards.
Sensei is flexible
In that way, Sensei is a bit of a mix, since it's:
- part Static Analyser
- coding tutor
- rewrite engine
Sensei is flexible enough to make the job of saying "What is Sensei?" that little bit harder.
Sensei fills a gap in the programming workflow
We've tried to make Sensei the missing piece of the programmer workflow that helps you improve specific elements in your coding style, or library use, that you and your team are currently working with.
This flexibility means that it takes a little more time to get to grips with Sensei than a static analysis tool or the built-in IntelliJ Intentions. Still, by spending the time to experiment, you will gain a new way to speed up your learning in your personal development process.
How to experiment?
Once you have downloaded and installed Sensei from the [Intellij Marketplace]
The easiest way to make Sensei work for you is to look at your coding process and consider:
- What documentation do you keep looking up?
-- You could add some Sensei recipes that link back to that documentation. - What simple mistakes do you keep making?
-- You could temporarily codify that poor coding pattern as a matcher, and write a Quick Fix rewrite that amends the code to be what you really want to write. - What boilerplate code do you write to use a library?
-- You could create a Quick Fix rule to write the code for you.
Since Sensei is designed to work alongside whatever static analysis tool you're using, if you find that the same violations are being reported from static analysis, then you could replicate the condition in a Sensei recipe. You can then add a Quick Fix to help train you, not just to identify the mistake, but also to move quickly to writing the correct code
The Sensei plugin provides an easy way to find specific code patterns in your source code, and then apply rewrite rules to amend the matching code. All within the Intellij IDE, and in real-time.
For example, you could create a rule that matches on JUnit `@Disabled` annotations which do not have a reason, Sensei would then tell you about the issue by highlighting the code in the IDE.
Additionally, when you `alt+enter`, you can have the option to `Add a todo comment parameter`.
When selected, this would amend the code to add a boilerplate reason, which you can then amend, and if you don't, it will show up in your TODO panel.
e.g. `@Disabled` would become ` @Disabled("TODO: add a description here")`
Sensei combines the functionality of a Static Analysis code scanner with a code rewriting engine.
IntelliJ Intention Actions
Based on the above description, the obvious alternative (if you were not using Sensei) is to use the IntelliJ Intention Actions functionality.
Sensei differs from IntelliJ Intention Actions because the aim with Sensei is to provide a way to create matchers and rewriters which are project specific, or even local to an individual developer.
We have tried to put together a GUI that makes both the matching and rewrite rules easy to write and experiment with.
How can it help me personally improve?
When I'm learning a new library, it takes me time to build up muscle memory around the methods and formatting. So I might choose to create personal recipes which
- link off to the official documentation or tutorial pages
- have boilerplate templates which are most effective
- fix poor coding practices
- add boilerplate code to help use a library
I can use Sensei to build temporary recipes which prompt me for the current practices I've chosen to use and help me build up effective habits. And the recipes are temporary because I can remove them when I outgrow them.
How can it help my team improve?
In the same way we can help teams build up muscle memory around agreed coding standards.
Creating cookbooks of recipes that we apply when we find the same comments in pull request reviews. Since the cookbooks are stored in version control with the project, they are available to everyone on the project. And we can switch them off when we no longer need prompting.
Sensei helps provide feedback early
What we've tried to build with Sensei is a way of pulling the feedback that helps us improve, and reminders of corrective action, as early into the coding process as we can.
Rather than wait for
- the results of a static analyser
- the comments from a code review
We can instead see the feedback, for custom standards we want to enforce, as we code.
And we have either reminders, or actual rewrite rules, to help us write code that complies with the standards.
Sensei is flexible
In that way, Sensei is a bit of a mix, since it's:
- part Static Analyser
- coding tutor
- rewrite engine
Sensei is flexible enough to make the job of saying "What is Sensei?" that little bit harder.
Sensei fills a gap in the programming workflow
We've tried to make Sensei the missing piece of the programmer workflow that helps you improve specific elements in your coding style, or library use, that you and your team are currently working with.
This flexibility means that it takes a little more time to get to grips with Sensei than a static analysis tool or the built-in IntelliJ Intentions. Still, by spending the time to experiment, you will gain a new way to speed up your learning in your personal development process.
How to experiment?
Once you have downloaded and installed Sensei from the [Intellij Marketplace]
The easiest way to make Sensei work for you is to look at your coding process and consider:
- What documentation do you keep looking up?
-- You could add some Sensei recipes that link back to that documentation. - What simple mistakes do you keep making?
-- You could temporarily codify that poor coding pattern as a matcher, and write a Quick Fix rewrite that amends the code to be what you really want to write. - What boilerplate code do you write to use a library?
-- You could create a Quick Fix rule to write the code for you.
Since Sensei is designed to work alongside whatever static analysis tool you're using, if you find that the same violations are being reported from static analysis, then you could replicate the condition in a Sensei recipe. You can then add a Quick Fix to help train you, not just to identify the mistake, but also to move quickly to writing the correct code
Click on the link below and download the PDF of this resource.
Secure Code Warrior is here for your organization to help you secure code across the entire software development lifecycle and create a culture in which cybersecurity is top of mind. Whether you’re an AppSec Manager, Developer, CISO, or anyone involved in security, we can help your organization reduce risks associated with insecure code.
View reportBook a demoAlan Richardson has more than twenty years of professional IT experience, working as a developer and at every level of the testing hierarchy from Tester through to Head of Testing. Head of Developer Relations at Secure Code Warrior, he works directly with teams, to improve the development of quality secure code. Alan is the author of four books including “Dear Evil Tester”, and “Java For Testers”. Alan has also created online training courses to help people learn Technical Web Testing and Selenium WebDriver with Java. Alan posts his writing and training videos on SeleniumSimplified.com, EvilTester.com, JavaForTesters.com, and CompendiumDev.co.uk.
The Sensei plugin provides an easy way to find specific code patterns in your source code, and then apply rewrite rules to amend the matching code. All within the Intellij IDE, and in real-time.
For example, you could create a rule that matches on JUnit `@Disabled` annotations which do not have a reason, Sensei would then tell you about the issue by highlighting the code in the IDE.
Additionally, when you `alt+enter`, you can have the option to `Add a todo comment parameter`.
When selected, this would amend the code to add a boilerplate reason, which you can then amend, and if you don't, it will show up in your TODO panel.
e.g. `@Disabled` would become ` @Disabled("TODO: add a description here")`
Sensei combines the functionality of a Static Analysis code scanner with a code rewriting engine.
IntelliJ Intention Actions
Based on the above description, the obvious alternative (if you were not using Sensei) is to use the IntelliJ Intention Actions functionality.
Sensei differs from IntelliJ Intention Actions because the aim with Sensei is to provide a way to create matchers and rewriters which are project specific, or even local to an individual developer.
We have tried to put together a GUI that makes both the matching and rewrite rules easy to write and experiment with.
How can it help me personally improve?
When I'm learning a new library, it takes me time to build up muscle memory around the methods and formatting. So I might choose to create personal recipes which
- link off to the official documentation or tutorial pages
- have boilerplate templates which are most effective
- fix poor coding practices
- add boilerplate code to help use a library
I can use Sensei to build temporary recipes which prompt me for the current practices I've chosen to use and help me build up effective habits. And the recipes are temporary because I can remove them when I outgrow them.
How can it help my team improve?
In the same way we can help teams build up muscle memory around agreed coding standards.
Creating cookbooks of recipes that we apply when we find the same comments in pull request reviews. Since the cookbooks are stored in version control with the project, they are available to everyone on the project. And we can switch them off when we no longer need prompting.
Sensei helps provide feedback early
What we've tried to build with Sensei is a way of pulling the feedback that helps us improve, and reminders of corrective action, as early into the coding process as we can.
Rather than wait for
- the results of a static analyser
- the comments from a code review
We can instead see the feedback, for custom standards we want to enforce, as we code.
And we have either reminders, or actual rewrite rules, to help us write code that complies with the standards.
Sensei is flexible
In that way, Sensei is a bit of a mix, since it's:
- part Static Analyser
- coding tutor
- rewrite engine
Sensei is flexible enough to make the job of saying "What is Sensei?" that little bit harder.
Sensei fills a gap in the programming workflow
We've tried to make Sensei the missing piece of the programmer workflow that helps you improve specific elements in your coding style, or library use, that you and your team are currently working with.
This flexibility means that it takes a little more time to get to grips with Sensei than a static analysis tool or the built-in IntelliJ Intentions. Still, by spending the time to experiment, you will gain a new way to speed up your learning in your personal development process.
How to experiment?
Once you have downloaded and installed Sensei from the [Intellij Marketplace]
The easiest way to make Sensei work for you is to look at your coding process and consider:
- What documentation do you keep looking up?
-- You could add some Sensei recipes that link back to that documentation. - What simple mistakes do you keep making?
-- You could temporarily codify that poor coding pattern as a matcher, and write a Quick Fix rewrite that amends the code to be what you really want to write. - What boilerplate code do you write to use a library?
-- You could create a Quick Fix rule to write the code for you.
Since Sensei is designed to work alongside whatever static analysis tool you're using, if you find that the same violations are being reported from static analysis, then you could replicate the condition in a Sensei recipe. You can then add a Quick Fix to help train you, not just to identify the mistake, but also to move quickly to writing the correct code
Table of contents
Alan Richardson has more than twenty years of professional IT experience, working as a developer and at every level of the testing hierarchy from Tester through to Head of Testing. Head of Developer Relations at Secure Code Warrior, he works directly with teams, to improve the development of quality secure code. Alan is the author of four books including “Dear Evil Tester”, and “Java For Testers”. Alan has also created online training courses to help people learn Technical Web Testing and Selenium WebDriver with Java. Alan posts his writing and training videos on SeleniumSimplified.com, EvilTester.com, JavaForTesters.com, and CompendiumDev.co.uk.
Secure Code Warrior is here for your organization to help you secure code across the entire software development lifecycle and create a culture in which cybersecurity is top of mind. Whether you’re an AppSec Manager, Developer, CISO, or anyone involved in security, we can help your organization reduce risks associated with insecure code.
Book a demoDownloadResources to get you started
Benchmarking Security Skills: Streamlining Secure-by-Design in the Enterprise
The Secure-by-Design movement is the future of secure software development. Learn about the key elements companies need to keep in mind when they think about a Secure-by-Design initiative.
DigitalOcean Decreases Security Debt with Secure Code Warrior
DigitalOcean's use of Secure Code Warrior training has significantly reduced security debt, allowing teams to focus more on innovation and productivity. The improved security has strengthened their product quality and competitive edge. Looking ahead, the SCW Trust Score will help them further enhance security practices and continue driving innovation.
Resources to get you started
Reactive Versus Preventive Security: Prevention Is a Better Cure
The idea of bringing preventive security to legacy code and systems at the same time as newer applications can seem daunting, but a Secure-by-Design approach, enforced by upskilling developers, can apply security best practices to those systems. It’s the best chance many organizations have of improving their security postures.
The Benefits of Benchmarking Security Skills for Developers
The growing focus on secure code and Secure-by-Design principles requires developers to be trained in cybersecurity from the start of the SDLC, with tools like Secure Code Warrior’s Trust Score helping measure and improve their progress.
Driving Meaningful Success for Enterprise Secure-by-Design Initiatives
Our latest research paper, Benchmarking Security Skills: Streamlining Secure-by-Design in the Enterprise is the result of deep analysis of real Secure-by-Design initiatives at the enterprise level, and deriving best practice approaches based on data-driven findings.
Deep Dive: Navigating the Critical CUPS Vulnerability in GNU-Linux Systems
Discover the latest security challenges facing Linux users as we explore recent high-severity vulnerabilities in the Common UNIX Printing System (CUPS). Learn how these issues may lead to potential Remote Code Execution (RCE) and what you can do to protect your systems.