CodeQue

Get startedDocsRoadmapMissionPlayground

CodeQue

Multiline search for any programming language

Structural search for JavaScript and TypeScript

„Saves a lot of time and struggle by providing more accurate search results.”

CodeQue is a revolutionary codebase search and replace engine

  • flexible code-like query language

  • formatting agnostic multiline code search

  • easy to use regexp search

  • syntax aware code replace mechanism

  • batch refactoring without codemods

  • linting restricted syntax

  • duplicated code detection

  • file imports based search

Structural search using code-like query language

Code search should be easy and accurate.

With CodeQue you can look for complex code patterns flawlessly.

Query

Root:/codeque
Mode:exact
Case:insensitive
<Button size="md" onClick={$$$} >
try$$
</Button>
$$$ // is a statement or expression wildcard
$$ // is an identifier or string wildcard
// Each query is a valid code, so simple!

Results

<Button
size="md"
onClick={() => redirect('/playground')}
>
try in playground
</Button>
<Button
size="md"
onClick={openVSCodeExtPage}
>
Try CodeQue
</Button>

You don't have to be explicit

Use "include" mode to find similar, instead of exactly matching code.

Actual code can have more properties than the query.

Query

Root:/codeque
Mode:include
Case:sensitive
({
firstName: "John",
lastName: "Doe"
})

Results

({
id: 128,
firstName: "John",
lastName: "Doe",
age: 32
})
({
id: 256,
// different order is supported!
lastName: "Doe",
firstName: "John",
favColor: 'violet'
})

Find code regardless the formatting

Finding similar code usually does not work due to line breaks and indentation.

CodeQue performs structural comparison of the code, so different formatting is no longer an issue!

Query

Root:/codeque
Mode:exact
Case:sensitive
const result = updateData({
userId: me.id,
data: {
tasks: ['Try CodeQue']
}
})

Whitespaces finally become truly invisible!

Results

const result = updateData({
userId: me.id,
data: { tasks: [
'Try CodeQue'
]}
})
const result =
updateData({ userId: me.id,
data: {
tasks: ['Try CodeQue']}
})

Noticed some duplicated code?

Feels like the block you refactored recently keeps popping in new places?

Using multiline code search you can actually make sure you found all the occurrences.

Query

Root:/codeque
Mode:include
Case:sensitive
const user = await db.users.find($$$)
const { emailConfirmed } = user
if (!emailConfirmed) {
throw new Error("User inactive")
}

By knowing all of them you can secure the pattern from being copy-pasted again.

Results

async function getActiveUserById(id) {
const user = await db.users.find({ id })
const { emailConfirmed } = user
if (!emailConfirmed) {
throw new Error("User inactive")
}
return user
}
const user = await db.users.find({ id : userId })
const { emailConfirmed } = user
if (!emailConfirmed) {
throw new Error("User inactive")
}
// [...]
return user.tasks.filter(({ done }) => !done)

Explore codebase to make better refactoring decisions

It is useful to know how exactly the code is used before starting the refactor.

Instead of going through everything manually just write some query.

CodeQue search makes it easy to discover every specific usage of an API.

Query

Root:/codeque
Mode:include
Case:sensitive
MessageService.send({
transport: 'sms'
})

Regardless it is a function call or a React component.

No results

/**
*
* Seems like SMS transport is not used...
*
* We can securely remove that functionality
* while decoupling the MessageService!
*
**/

Enforce coding standards tailored to your codebase

I believe developers communicates through the code.

There is no better guideline than warning visible right in the code editor.

You can comment existing code, but how to add comments in the future code?

Sometimes existing eslint rules are not enough.

Use CodeQue to restrict undesired code constructs specific to your codebase.

It saves time and intellectual fatigue during code reviews.

Query

Root:/codeque
Mode:include
Case:sensitive
// This code is deprecated
TrackingX.trackEvent()
// We are migrating to new TrackingY provider

No more "Don't use X", "We are migrating from Y to Z".

Invalid Code

const handleClick = () => {
TrackingX.trackEvent("Clicked Product Card")
router.redirect("/product/" + id)
}

Valid Code

{
const { taskId } = await db.tasks.create({
title,
userId
})
TrackingY.log({
name: "Task Created By",
taskId,
userId
})
return { taskId }
}

Want to learn more or ask a Question?

Just DM me on X (Twitter)!