找回密码
 立即注册

QQ登录

只需一步,快速开始

[工具插件] 微信小程序跳转层数检测工具WXANavigationTester

[复制链接]
查看: 428|回复: 6
最佳答案
1 

2

主题

7

帖子

64

积分

新人求带

积分
64
 楼主| 发表于 2017-3-20 15:13:00 | 显示全部楼层 |阅读模式
WXANavigationTester

微信小程序跳转层数检测工具

配置需求
  • 该脚本采用Python3编写,理论上兼容Python2
  • 无需任何依赖包


用法

将 testNavigation.py 拷贝到有 app.json 的微信小程序根目录并运行即可。另外具有调试参数 -d 可以完整展示整个遍历过程。

原理

该脚本先利用文件系统操作,列出当前小程序目录下所有的 navigateTo 跳转和 redirectTo 重定向;然后采用带权有向图结构,按照跳转权为1、重定向权为0,作出相应的出边表,然后从每个入度为0的节点开始,对这个图结构采用深度优先遍历,查找长度超过5的路径以及长度不为0的环。

示例输出
$ python testNavigate.py
微信小程序跳转层数检查工具
支持 Python 2/3 全版本

Usage:
加参数 -d 可显示所有跳转栈遍历结果;
'->' 表示进入一级页面或 redirectTo,'~>' 表示 navigateTo。

-> /pages/my/my [ ~> /pages/postDetail/postDetail ~> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail]
[!] 跳转栈存在不全是重定向的环。删除其中的某个跳转,或将循环中的所有跳转改为重定向。

-> /pages/circle/circle [ ~> /pages/postDetail/postDetail ~> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail]
[!] 跳转栈存在不全是重定向的环。删除其中的某个跳转,或将循环中的所有跳转改为重定向。

请修正以上问题后,再次运行本工具进行检查
$ python testNavigate.py -d
微信小程序跳转层数检查工具
支持 Python 2/3 全版本

Usage:
加参数 -d 可显示所有跳转栈遍历结果;
'->' 表示进入一级页面或 redirectTo,'~>' 表示 navigateTo。

-> /pages/index/index ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/index/index ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/index/index ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/index/index ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/index/index ~> /pages/masterDetail/masterDetail
-> /pages/index/index ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/index/index ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/index/index ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/index/index ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/index/index ~> /pages/courseDetail/courseDetail
-> /pages/index/index ~> /pages/myOrder/myOrder ~> /pages/orderDetail/orderDetail
-> /pages/index/index ~> /pages/myOrder/myOrder
-> /pages/index/index ~> /pages/allMaster/allMaster ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/index/index ~> /pages/allMaster/allMaster ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/index/index ~> /pages/allMaster/allMaster ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/index/index ~> /pages/allMaster/allMaster ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/index/index ~> /pages/allMaster/allMaster ~> /pages/masterDetail/masterDetail
-> /pages/index/index ~> /pages/allMaster/allMaster
-> /pages/index/index ~> /pages/masterApply/masterApply
-> /pages/index/index ~> /pages/allCourse/allCourse ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/index/index ~> /pages/allCourse/allCourse ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/index/index ~> /pages/allCourse/allCourse ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/index/index ~> /pages/allCourse/allCourse ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/index/index ~> /pages/allCourse/allCourse ~> /pages/courseDetail/courseDetail
-> /pages/index/index ~> /pages/allCourse/allCourse
-> /pages/index/index
-> /pages/my/my ~> /pages/myOrder/myOrder ~> /pages/orderDetail/orderDetail
-> /pages/my/my ~> /pages/myOrder/myOrder
-> /pages/my/my ~> /pages/myInfo/myInfo ~> /pages/editInfo/editInfo
-> /pages/my/my ~> /pages/myInfo/myInfo
-> /pages/my/my ~> /pages/masterApply/masterApply
-> /pages/my/my ~> /pages/postDetail/postDetail ~> /pages/publish/publish
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/publish/publish
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail
-> /pages/my/my ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay
-> /pages/my/my ~> /pages/postDetail/postDetail
-> /pages/my/my ~> /pages/myFollowee/myFollowee
-> /pages/my/my
-> /pages/circle/circle ~> /pages/publish/publish
-> /pages/circle/circle ~> /pages/postDetail/postDetail ~> /pages/publish/publish
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/publish/publish
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail
-> /pages/circle/circle ~> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay
-> /pages/circle/circle ~> /pages/postDetail/postDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/masterDetail/masterDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail ~> /pages/publish/publish
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail -> /pages/masterDisplay/masterDisplay
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay -> /pages/postDetail/postDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/publish/publish
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply -> /pages/orderDetail/orderDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail ~> /pages/courseApply/courseApply
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail -> /pages/courseDetail/courseDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail -> /pages/masterDetail/masterDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay ~> /pages/courseDetail/courseDetail
-> /pages/circle/circle ~> /pages/masterDisplay/masterDisplay
-> /pages/circle/circle
没有发现问题。

游客,如果您要查看本帖隐藏内容请回复

回复

使用道具 举报

最佳答案
1 

1

主题

10

帖子

77

积分

新人求带

积分
77
发表于 2017-3-20 16:27:38 | 显示全部楼层
看起来就一个py脚本的事
回复 支持 反对

使用道具 举报

最佳答案
2 

0

主题

66

帖子

738

积分

专家路上

积分
738

积极分子

QQ
发表于 2017-3-21 09:46:21 | 显示全部楼层
py绝对是py
回复 支持 反对

使用道具 举报

最佳答案
0 

0

主题

23

帖子

441

积分

略知一二

积分
441
发表于 2017-3-21 13:42:54 | 显示全部楼层
学习一下Python
回复 支持 反对

使用道具 举报

最佳答案
0 

25

主题

106

帖子

6330

积分

S2

积分
6330
QQ
发表于 2017-3-22 04:41:11 | 显示全部楼层
1111111111111111111
回复 支持 反对

使用道具 举报

最佳答案
0 

0

主题

150

帖子

1725

积分

专家路上

积分
1725
发表于 2017-3-24 14:32:23 | 显示全部楼层
感谢分享
回复

使用道具 举报

最佳答案
0 

0

主题

150

帖子

1725

积分

专家路上

积分
1725
发表于 2017-3-24 14:32:25 | 显示全部楼层
感谢分享
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条


易域网-您身边的域名管家

henkuai.com是专业的第三方微信开发者平台,为生态而生。


本站为第三方微信开发者平台,非腾讯官方网站。

天津市滨海新区
中新生态城中成大道生态建设公寓9号楼3层301

欢迎来这里一起喝喝茶,
聊聊你的产品。

微信公众号gongzhongkaifa

工作日12小时内回复。

网站业务
zhongcong@henkuai.com

工作日12小时内回复。

市场合作
songchang@henkuai.com