Comments (7)
Could you please provide an example? E.g. as source snippet and what you are looking for.
from plscope-utils.
Suppose I have a subtype declared in some package say pkgsubtype" and I am declaring a local variable based on that in my all proc as this is standard I want to follow in my procedure.
Declare
v_procname pkgsubtype.proc_name;
It migh happended a new joinee is unaware of something like this and created his own declaration like below
v_procname varchar2(50);
Which is my area of pain as I want identify custom code like this as error.
In brief above was just a sample my intention is to find any specific pattern if someone is deviating from that than it should be marked as not ok.
Hope this clear your doubt. I know its not straight forward but just wondering if this can be done.
from plscope-utils.
Also How to check naming convention for constraint,PK,FK etc ..? Is their any provision ?
from plscope-utils.
Let's create some example code
CREATE OR REPLACE PROCEDURE good IS
l_dname dept.dname%type;
BEGIN
NULL;
END;
/
CREATE OR REPLACE PROCEDURE bad IS
l_dname VARCHAR2(100);
BEGIN
NULL;
END;
/
CREATE OR REPLACE PACKAGE mytypes IS
SUBTYPE dname_type IS VARCHAR2(14 BYTE);
END;
/
CREATE OR REPLACE PROCEDURE good2 IS
l_dname mytypes.dname_type;
BEGIN
NULL;
END;
/
and here's a PL/Scope which reduces the results to relevant columns and declared variables:
SELECT p.name, c.type AS ref_type, c.name AS ref_name, c.text
FROM plscope_identifiers p
JOIN plscope_identifiers c
ON p.owner = c.owner
AND p.object_type = c.object_type
AND p.object_name = c.object_name
AND p.usage_id = c.usage_context_id
WHERE p.type = 'VARIABLE'
AND p.usage = 'DECLARATION'
AND p.object_name IN ('BAD','GOOD', 'GOOD2');
The result of the query is
NAME REF_TYPE REF_NAME TEXT
--------------- -------------------- --------------- -----------------------------------
L_DNAME TABLE DEPT l_dname dept.dname%type;
L_DNAME PACKAGE MYTYPES l_dname mytypes.dname_type;
L_DNAME CHARACTER DATATYPE VARCHAR2 l_dname VARCHAR2(100);
You may now filter the result based on REF_TYPE
. Please have a look at the PL/Scope documentation to find other values expected in REF_TYPE
. Filtering on CHARACTER DATATYPE
will not be enough for all use cases.
from plscope-utils.
Please open another issue regarding naming conventions. Just to avoid mixing things in this thread. Thanks.
from plscope-utils.
Thanks Phillips but how to include same in plscope_naming view? .What if that pattern doesn't exists in declaration part and exists in body part of any procedure /pkg/function and that can be any custom code e.g.
I want to search for a specific pattern in my code like what pattern team has used for commenting
/*Multi line code
comments with single start
*/
or
/** double start comments**/
or
--Single line comments
and suppose I want to restrict team to use only /** */ pattern and not others and I want this to be included in plscope_naming view and I can set the COMMENT_REGEXE
exec plscope_context.set_attr('COMMENTS_REGEXE','(.**//.)|(/*.)|(--.*)|(((/*)+?[\w\W]+?(*/)+))');
Please advise.
from plscope-utils.
PL/Scope is not a full parsing solution. It just reports identifiers and SQL statements during parse time with some context information.
Comments are not covered by PL/Scope. Hence you need to parse the comments from dba_source or from source files yourself. BTW the regex will become a bit more complex since you have to exclude comments in string literals.
So, there are no plans to cover comments in plscope-utils.
from plscope-utils.
Related Issues (20)
- Do not use sys_context('userenv', 'authenticated_identity') for schemas
- Update formatter to 22.2.1
- Fix issues reported by SonarCloud
- View not created with SQL*Plus from the Instant Client 18.5 bundle for Windows x64. HOT 3
- Installation with SQL*Plus fails with ORA-00903: invalid table name HOT 2
- The "Compile with PL/Scope" action affects only the session user HOT 5
- The "Compile with PL/Scope" action could use DBA_xxx views if available HOT 2
- "Compile with PL/Scope" action: compiling private and public synonyms should be separate choices HOT 1
- The "Compile with PL/Scope" action should preserve prior PL/SQL compilation settings HOT 1
- The "Compile with PL/Scope" action should not use dbms_utility.compile_schema HOT 4
- The "Compile with PLScope" action should not touch Oracle-maintained schemas HOT 1
- SQL Developer extension: add a report for viewing synonyms compiled with/without PL/Scope HOT 2
- plscope_tab_usage is a bit slow HOT 1
- plscope_tab_usage does not always handle synonyms consistently HOT 1
- plscope_tab_usage may return duplicate rows HOT 1
- plscope_tab_usage ignores object tables HOT 1
- SQL Dev extension: No filter on owner of a synonym HOT 5
- SQL Dev extension: plscope-utils tabs are not displayed in the main editors for PL/SQL types HOT 1
- SQL Dev extension: source text appears as null on the "Used By" tab HOT 1
- lineage_util does not traverse chains of synonyms HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plscope-utils.