JIRA how to format code python, SQL, Java

You have two options of formatting code in JIRA:

  • using a plugin
  • using code template

In this post I'll add several templates for:

Add JIRA comment with Python code

{code:python}

def fib(i):
    if i <= 2:
        return 1;
    else:
        f = fib(i-1) + fib(i-2)
        print('calc', i)
    return f
print(fib(6))

{code}

Add JIRA comment with SQL code

{code:sql}

select * from mytable

{code}

Add JIRA comment with Java code

You can add additional parameters like:

  • title
  • borderStyle

{code:title=Bar.java|borderStyle=solid}

public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }

}

{code}

Related Article